Repository: born2net/studio-lite
Branch: master
Commit: 60ec84ad4c25
Files: 337
Total size: 4.8 MB
Directory structure:
gitextract_0m1po494/
├── .angular-cli.json
├── .editorconfig
├── .gitignore
├── LICENSE
├── README.md
├── db-design.psd
├── dev/
│ └── notes.txt
├── e2e/
│ ├── app.e2e-spec.ts
│ ├── app.po.ts
│ └── tsconfig.json
├── examples/
│ ├── adStatsSample.xml
│ ├── apps_table.txt
│ ├── calendar_google.xml
│ ├── collection.xml
│ ├── collection_scene.xml
│ ├── digg.xml
│ ├── googlesheets.xml
│ ├── instagram_feed.xml
│ ├── jsonItem.xml
│ ├── jsonPlayer.xml
│ ├── json_as3_maps.xml
│ ├── json_scenes.xml
│ ├── jsonsheets.xml
│ ├── location.xml
│ ├── player_weather_scene.xml
│ ├── reseller_sample.xml
│ ├── sceneSample.xml
│ ├── sceneSampleLayout.xml
│ ├── twitterv3.xml
│ └── worldweather.xml
├── notes.txt
├── package.json
├── src/
│ ├── Lib.ts
│ ├── app/
│ │ ├── app-component.css
│ │ ├── app-component.html
│ │ ├── app-component.ts
│ │ ├── app-module.ts
│ │ ├── appwrap.ts
│ │ ├── blocks/
│ │ │ ├── block-fabric-image.ts
│ │ │ ├── block-fabric-josn-item.ts
│ │ │ ├── block-fabric-label.ts
│ │ │ ├── block-fabric-scene.ts
│ │ │ ├── block-fabric-svg.ts
│ │ │ ├── block-fabric.ts
│ │ │ ├── block-prop-calendar.ts
│ │ │ ├── block-prop-clock.ts
│ │ │ ├── block-prop-collection.ts
│ │ │ ├── block-prop-common.ts
│ │ │ ├── block-prop-container.ts
│ │ │ ├── block-prop-fasterq.ts
│ │ │ ├── block-prop-html.ts
│ │ │ ├── block-prop-image.ts
│ │ │ ├── block-prop-instagram.ts
│ │ │ ├── block-prop-json-item.ts
│ │ │ ├── block-prop-json-player.ts
│ │ │ ├── block-prop-label.ts
│ │ │ ├── block-prop-location.ts
│ │ │ ├── block-prop-mrss.ts
│ │ │ ├── block-prop-position.ts
│ │ │ ├── block-prop-qr.ts
│ │ │ ├── block-prop-rss.ts
│ │ │ ├── block-prop-scene.ts
│ │ │ ├── block-prop-sheets.ts
│ │ │ ├── block-prop-twitter.ts
│ │ │ ├── block-prop-video.ts
│ │ │ ├── block-prop-weather.ts
│ │ │ ├── block-prop-youtube.ts
│ │ │ ├── block-prop.digg.ts
│ │ │ ├── block-service.ts
│ │ │ └── json-event-grid.ts
│ │ ├── campaigns/
│ │ │ ├── add-content.ts
│ │ │ ├── campaign-channels.ts
│ │ │ ├── campaign-duration.ts
│ │ │ ├── campaign-editor-props.ts
│ │ │ ├── campaign-editor.ts
│ │ │ ├── campaign-editors.html
│ │ │ ├── campaign-layout.ts
│ │ │ ├── campaign-list.ts
│ │ │ ├── campaign-manager.html
│ │ │ ├── campaign-manager.ts
│ │ │ ├── campaign-name.ts
│ │ │ ├── campaign-orientation.ts
│ │ │ ├── campaign-props-manager.ts
│ │ │ ├── campaign-props.ts
│ │ │ ├── campaign-resolution.ts
│ │ │ ├── campaign-sched-props.css
│ │ │ ├── campaign-sched-props.html
│ │ │ ├── campaign-sched-props.ts
│ │ │ ├── campaign-story-timeline.ts
│ │ │ ├── campaigns-navigation.ts
│ │ │ ├── campaigns.ts
│ │ │ ├── channel-block-props.ts
│ │ │ ├── channel-props.ts
│ │ │ ├── dashboard-props.ts
│ │ │ ├── index.ts
│ │ │ ├── screen-layout-editor-props.ts
│ │ │ ├── screen-layout-editor.ts
│ │ │ ├── sequencer.ts
│ │ │ ├── timeline/
│ │ │ │ ├── timeline.component.css
│ │ │ │ ├── timeline.component.html
│ │ │ │ ├── timeline.component.spec.ts
│ │ │ │ └── timeline.component.ts
│ │ │ ├── timeline-props.ts
│ │ │ └── timeline-ruler/
│ │ │ ├── timeline-ruler.component.css
│ │ │ ├── timeline-ruler.component.html
│ │ │ ├── timeline-ruler.component.spec.ts
│ │ │ └── timeline-ruler.component.ts
│ │ ├── dashboard/
│ │ │ ├── dash-panel-mini.html
│ │ │ ├── dash-panel-mini.ts
│ │ │ ├── dash-panel.html
│ │ │ ├── dash-panel.ts
│ │ │ ├── dashboard-navigation.ts
│ │ │ ├── server-avg.ts
│ │ │ └── storage-used.ts
│ │ ├── fasterq/
│ │ │ ├── fasterq-editor.html
│ │ │ ├── fasterq-editor.ts
│ │ │ ├── fasterq-line-props.ts
│ │ │ ├── fasterq-manager.ts
│ │ │ ├── fasterq-navigation.ts
│ │ │ ├── fasterq-terminal.ts
│ │ │ ├── fasterq.ts
│ │ │ └── index.ts
│ │ ├── help/
│ │ │ ├── help-navigation.ts
│ │ │ └── index.ts
│ │ ├── index.ts
│ │ ├── install/
│ │ │ ├── index.ts
│ │ │ └── install-navigation.ts
│ │ ├── live-preview/
│ │ │ └── live-preview.ts
│ │ ├── locale-selector/
│ │ │ ├── local-selector.css
│ │ │ └── local-selector.ts
│ │ ├── location/
│ │ │ ├── location-map.html
│ │ │ └── location-map.ts
│ │ ├── resources/
│ │ │ ├── index.ts
│ │ │ ├── orders.ts
│ │ │ ├── resource-props-manager.ts
│ │ │ ├── resources-list.ts
│ │ │ ├── resources-navigation.ts
│ │ │ └── resources.ts
│ │ ├── route-animation.ts
│ │ ├── scenes/
│ │ │ ├── index.ts
│ │ │ ├── scene-creator.css
│ │ │ ├── scene-creator.ts
│ │ │ ├── scene-editor.ts
│ │ │ ├── scene-list.ts
│ │ │ ├── scene-manager.ts
│ │ │ ├── scene-props-manager.ts
│ │ │ ├── scene-toolbar.ts
│ │ │ ├── scenes-navigation.ts
│ │ │ └── scenes.ts
│ │ ├── settings/
│ │ │ ├── index.ts
│ │ │ ├── settings-navigation.ts
│ │ │ └── twofactor.ts
│ │ ├── stations/
│ │ │ ├── index.ts
│ │ │ ├── stations-list.ts
│ │ │ ├── stations-navigation.ts
│ │ │ ├── stations-props-manager.html
│ │ │ ├── stations-props-manager.ts
│ │ │ └── stations.ts
│ │ └── studiopro/
│ │ ├── index.ts
│ │ ├── pro-upgrade.ts
│ │ ├── pro-upgrades.html
│ │ └── studiopro-navigation.ts
│ ├── app-routes.ts
│ ├── assets/
│ │ └── geojson.json
│ ├── comps/
│ │ ├── blurforwarder/
│ │ │ └── BlurForwarder.ts
│ │ ├── connect-form/
│ │ │ └── connect-form.ts
│ │ ├── contact-us/
│ │ │ └── contact-us.ts
│ │ ├── disable-control/
│ │ │ └── disable-control.ts
│ │ ├── draggable-list/
│ │ │ └── draggable-list.ts
│ │ ├── duration-input/
│ │ │ ├── duration-input.component.css
│ │ │ ├── duration-input.component.html
│ │ │ ├── duration-input.component.spec.ts
│ │ │ └── duration-input.component.ts
│ │ ├── entry/
│ │ │ ├── AutoLogin.ts
│ │ │ └── LoginPanel.ts
│ │ ├── font-selector/
│ │ │ └── font-selector.ts
│ │ ├── hour-counter/
│ │ │ └── hour-counter.ts
│ │ ├── imgloader/
│ │ │ └── ImgLoader.ts
│ │ ├── infobox/
│ │ │ └── Infobox.ts
│ │ ├── lazy-image/
│ │ │ └── lazy-image.ts
│ │ ├── limited-access/
│ │ │ └── limited-access.ts
│ │ ├── loading/
│ │ │ └── loading.ts
│ │ ├── logo/
│ │ │ ├── Logo.ts
│ │ │ └── reseller-logo.ts
│ │ ├── logout/
│ │ │ └── Logout.ts
│ │ ├── match-body-height/
│ │ │ └── match-body-height.ts
│ │ ├── media-player/
│ │ │ └── media-player.ts
│ │ ├── ng-menu/
│ │ │ ├── ng-menu-item.ts
│ │ │ └── ng-menu.ts
│ │ ├── panel-split/
│ │ │ ├── panel-split-container.ts
│ │ │ ├── panel-split-main.ts
│ │ │ └── panel-split-side.ts
│ │ ├── screen-template/
│ │ │ └── screen-template.ts
│ │ ├── simple-grid-module/
│ │ │ ├── SimpleGrid.css
│ │ │ ├── SimpleGrid.ts
│ │ │ ├── SimpleGridData.ts
│ │ │ ├── SimpleGridDataChecks.ts
│ │ │ ├── SimpleGridDataCurrency.ts
│ │ │ ├── SimpleGridDataDropdown.ts
│ │ │ ├── SimpleGridDataImage.ts
│ │ │ ├── SimpleGridDraggable.ts
│ │ │ ├── SimpleGridExample.txt
│ │ │ ├── SimpleGridModule.ts
│ │ │ ├── SimpleGridRecord.ts
│ │ │ ├── SimpleGridSortableHeader.ts
│ │ │ └── SimpleGridTable.ts
│ │ ├── sliderpanel/
│ │ │ ├── SliderItemContent.ts
│ │ │ ├── Slideritem.ts
│ │ │ └── Sliderpanel.ts
│ │ ├── svg-icon/
│ │ │ └── svg-icon.ts
│ │ └── tabs/
│ │ ├── tab.ts
│ │ └── tabs.ts
│ ├── create_reflection.html
│ ├── decorators/
│ │ ├── once-decorator.ts
│ │ └── timeout-decorator.ts
│ ├── environments/
│ │ ├── environment.hmr.ts
│ │ ├── environment.prod.ts
│ │ └── environment.ts
│ ├── filters/
│ │ └── filter-model-pipe.ts
│ ├── hmr.ts
│ ├── index.html
│ ├── interfaces/
│ │ ├── BlockTypeEnum.ts
│ │ ├── Consts.ts
│ │ ├── IAddContent.ts
│ │ ├── IRegisterCaller.ts
│ │ └── IScreenTemplate.ts
│ ├── libs/
│ │ ├── bootstrap-timepicker/
│ │ │ ├── CHANGELOG.md
│ │ │ ├── README.md
│ │ │ ├── bower.json
│ │ │ ├── composer.json
│ │ │ ├── css/
│ │ │ │ ├── bootstrap-timepicker.css
│ │ │ │ ├── bootstrap-timepicker.min.css
│ │ │ │ └── timepicker.less
│ │ │ ├── js/
│ │ │ │ ├── bootstrap-timepicker.js
│ │ │ │ └── bootstrap-timepicker.min.js
│ │ │ └── package.json
│ │ ├── contextmenu/
│ │ │ └── bootstrap-contextmenu.js
│ │ ├── enjoyhint/
│ │ │ └── enjoyhint.js
│ │ ├── fabric.require1-4-12.js
│ │ ├── fabric.require1-4-12.min.js
│ │ ├── fabric1-4-2.min.js
│ │ ├── flashdetect/
│ │ │ └── flashdetect.js
│ │ ├── gradient/
│ │ │ ├── colorpicker.js
│ │ │ └── jquery.gradientpicker.js
│ │ ├── jquery-ui.js
│ │ ├── jquery.base64.js
│ │ ├── jquery.knob.min.js
│ │ ├── jquery.timepicker/
│ │ │ └── jquery.timepicker.min.js
│ │ ├── minicolors/
│ │ │ ├── jquery.minicolors.css
│ │ │ └── jquery.minicolors.js
│ │ ├── qrcode/
│ │ │ └── qrcode.js
│ │ ├── rc4v1/
│ │ │ └── rc4v1.js
│ │ ├── rc4v2/
│ │ │ └── rc4v2.js
│ │ ├── ruler/
│ │ │ ├── ruler.css
│ │ │ ├── ruler.js
│ │ │ ├── rulerConstructor.js
│ │ │ ├── rulerGuideLine.js
│ │ │ └── utils.js
│ │ ├── screen-templates.json
│ │ ├── stop-watch/
│ │ │ └── stop-watch.js
│ │ └── xml2js/
│ │ └── xml2js.js
│ ├── locale/
│ │ ├── ar.xtb
│ │ ├── be.xtb
│ │ ├── bn.xtb
│ │ ├── cs.xtb
│ │ ├── da.xtb
│ │ ├── de.xtb
│ │ ├── el.xtb
│ │ ├── en.xtb
│ │ ├── eo.xtb
│ │ ├── es.xtb
│ │ ├── fr.xtb
│ │ ├── hi.xtb
│ │ ├── it.xtb
│ │ ├── iw.xtb
│ │ ├── ja.xtb
│ │ ├── ko.xtb
│ │ ├── la.xtb
│ │ ├── messages.xmb
│ │ ├── pt.xtb
│ │ ├── ru.xtb
│ │ ├── template.xtb
│ │ ├── th.xtb
│ │ ├── tl.xtb
│ │ └── zh-CN.xtb
│ ├── main.ts
│ ├── manifest.json
│ ├── models/
│ │ ├── LocationMarkModel.ts
│ │ ├── StationModel.ts
│ │ ├── StoreModel.ts
│ │ ├── StoreModelAbstract.ts
│ │ ├── UserModel.ts
│ │ ├── fasterq-analytics.ts
│ │ ├── fasterq-line-model.ts
│ │ ├── fasterq-queue-model.ts
│ │ └── live-log-model.ts
│ ├── modules/
│ │ ├── ngmslib-service.ts
│ │ └── shared.module.ts
│ ├── pipes/
│ │ ├── format-seconds-pipe.ts
│ │ └── list-to-array-pipe.ts
│ ├── polyfills.ts
│ ├── print.html
│ ├── service-worker.js
│ ├── services/
│ │ ├── AuthService.ts
│ │ ├── CommBroker.ts
│ │ ├── CreditService.ts
│ │ ├── LocalStorage.ts
│ │ ├── StoreService.ts
│ │ ├── block-factory-service.ts
│ │ ├── font-loader-service.ts
│ │ ├── global-error-handler.ts
│ │ ├── redpepper.service.ts
│ │ ├── wizard-service.ts
│ │ └── yellowpepper.service.ts
│ ├── store/
│ │ ├── actions/
│ │ │ ├── appdb.actions.ts
│ │ │ └── msdb.actions.ts
│ │ ├── application.state.ts
│ │ ├── effects/
│ │ │ ├── appdb.effects.ts
│ │ │ └── msdb.effects.ts
│ │ ├── imsdb.interfaces.ts
│ │ ├── imsdb.interfaces_auto.ts
│ │ ├── model/
│ │ │ ├── StoreModel.ts
│ │ │ └── msdb-models-extended.ts
│ │ ├── reducers/
│ │ │ ├── appdb.reducer.ts
│ │ │ └── msdb.reducer.ts
│ │ ├── signage_sdk.js
│ │ └── store.data.ts
│ ├── styles/
│ │ ├── material-design/
│ │ │ └── css/
│ │ │ ├── bootstrap-material-design.css
│ │ │ └── ripples.css
│ │ ├── style.css
│ │ └── style_dark.css
│ ├── tsconfig.json
│ ├── typings.d.ts
│ └── validators/
│ ├── NameTakenValidator.ts
│ └── StartCapValidator.ts
├── tslint.json
└── typings.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .angular-cli.json
================================================
{
"project": {
"version": "1.0.0-beta.32.3",
"name": "StudioWeb"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico",
"manifest.json",
"service-worker.js"
],
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
"styles": [
"../node_modules/font-awesome/css/font-awesome.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"../node_modules/ng2-toastr/ng2-toastr.css",
"../node_modules/primeng/resources/themes/bootstrap/theme.css",
"../node_modules/primeng/resources/primeng.min.css",
"./libs/bootstrap-timepicker/css/bootstrap-timepicker.css",
"./libs/minicolors/jquery.minicolors.css",
"./libs/ruler/ruler.css",
"./styles/style.css",
"./styles/jquery.timepicker.min.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"./libs/jquery.base64.js",
"./libs/jquery-ui.js",
"./libs/jquery.knob.min.js",
"./libs/flashdetect/flashdetect.js",
"./libs/rc4v1/rc4v1.js",
"./libs/rc4v2/rc4v2.js",
"./libs/qrcode/qrcode.js",
"./libs/bootstrap-timepicker/js/bootstrap-timepicker.min.js",
"./libs/jquery.timepicker/jquery.timepicker.min.js",
"./libs/contextmenu/bootstrap-contextmenu.js",
"./libs/stop-watch/stop-watch.js",
"./store/signage_sdk.js",
"../node_modules/bootstrap/dist/js/bootstrap.js",
"../node_modules/bootbox/bootbox.js",
"../node_modules/platform/platform.js",
"./libs/fabric.require1-4-12.js",
"./libs/minicolors/jquery.minicolors.js",
"./libs/gradient/colorpicker.js",
"./libs/xml2js/xml2js.js",
"./libs/gradient/jquery.gradientpicker.js",
"./libs/enjoyhint/enjoyhint.js",
"../node_modules/xdate/src/xdate.js",
"./libs/ruler/ruler.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"hmr": "environments/environment.hmr.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"addons": [
"../node_modules/font-awesome/fonts/*.+(otf|eot|svg|ttf|woff|woff2)",
"./styles/fonts//montserrat.woff2"
],
"packages": [],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"prefixInterfaces": false,
"inline": {
"style": false,
"template": false
},
"spec": {
"class": false,
"component": true,
"directive": true,
"module": false,
"pipe": true,
"service": true
}
}
}
================================================
FILE: .editorconfig
================================================
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false
================================================
FILE: .gitignore
================================================
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist/*.js
/dist/**
/dist
/tmp
# dependencies
/node_modules
/bower_components
# IDEs and editors
/.idea
/.idea/workspace.xml
/.vscode
.project
.classpath
.c9/
*.launch
.settings/
# misc
/.sass-cache
/documentation
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
/typings
*.log.*
#include
!index.js
!/typings
# js/map
*.js
src/**/*.js
*prod.js
src/**/*.map
#System Files
.DS_Store
Thumbs.db
workspace.xml
!signageSDK.js
!service-worker.js
!src/store/signage_sdk.js
!src/libs/*
!src/libs/**/*
!src/locale/**/*
#src/store/application.state.js
#src/store/imsdb.interfaces.js
#src/store/imsdb.interfaces_auto.js
#src/store/store.data.js
#*.xlf
#*.xmb
!temp/*.js
!temp/*.txt
================================================
FILE: LICENSE
================================================
======================================================================
MediaSignage Add-on license
to GNU GENERAL PUBLIC LICENSE V3
Jan 7, 2014
MediaSignage Inc SignagePlayer open source under GPL V3 modified license.
GPL V3 add-on License for MediaSignage Copyright (c) SignagePlayer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
to deal in the Software with some restriction as described in exhibit (A).
The SignagePlayer open source software is available without any warranty,
documentation and support. The primary purpose of this software is:
A) Educational: study of this product design and architecture
B) Security: transparency into the inner workings of the mediaCLOUD and related apps
C) All usage permitted only within the operation of the DigitalSignage.com mediaCLOUD
and only under MediaSignage Inc related products and services.
D) Customization and modification which are governed under items A-C
Exhibit A:
==========
Usage, modification, compilation and any other benefit of the SignagePlayer
source code must come in a form of connection into the MediaSignage public mediaCLOUD
service or to a private mediaSERVER purchased from MediaSignage Inc.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
================================================
FILE: README.md
================================================
StudioLite, Digital Signage for the rest of us
---------------------------------------
------------------------------------------------------------------------
StudioLite is an open source, 100% FREE, Digital Signage platform that was designed with ease of use in mind.
With StudioLite anyone can have a Digital Signage solution that is entirely customizable.
Take the source code, modify it, brand it and build a product that's right for you and your customers.
Best of all, you will take full advantage of the world's most popular Digital Signage cloud so you don't have to worry about backend programming or even setup a server, it's all done for you using the mediaCLOUD.
- Based on the poplar SignageStudio Pro ( [MediaSignage]: http://www.DigitalSignage.com )
- Connected to a private mediaSERVER or the public free mediaCLOUD
- 100% open source based on GNU V3 license
- Contributors are welcome, fork, modify and send pull requests
- Powered by Google's Angular Framework + TypeScript + ngrx
Links:
------------------------------------------------------------------------
- StudioLite documentation: http://www.digitalsignage.com/lite_docs/
- Cloud web app: http://go.digitalsignage.com
- Home: http://lite.digitalsignage.com
- Docs: http://www.digitalsignage.com/msdocs/
- Support: http://script.digitalsignage.com/forum/index.php/board,9.0.html
- Developer video tutorial: http://goo.gl/nkx7wr
- StudioLite intro video: http://lite.digitalsignage.com/video1.html
- StudioLite advanced video: http://lite.digitalsignage.com/video2.html
- Developers page: http://www.digitalsignage.com/_html/open_source_digital_signage.html
- Angular: https://angular.io/
Technical data:
------------------------------------------------------------------------
- Build on top the latest version Google's Angular framework with a clean MV* design
- Developed using the latest version of TypeScript and ngrx store
- Powered by Bootstrap using responsive design for phones, tablets and desktops
- Lazy loaded modules for best user load experience
- Driven using Soap API and includes Helper SDK
- Uses a local msdb (database) through SDK for offline work
- Support Angular AOT mode
- Support available through the MediaSignage support forum
Installation:
------------------------------------------------------------------------
StudioLite can be downloaded directly from GitHub
With git you will be able to easily update to the latest version of StudioLite as well as take advantage Angular CLI which is included in the bundle
currently the application should run under:
- typescript 2.4
- node 6.x
to install and host:
``` npm install -g npm``` (this will ensure npm 5.4.2 >)
```
git clone https://github.com/born2net/studio-lite.git
cd studio-lite
npm install -g @angular/cli@latest
npm install
open browser to: http://localhost:4208/
```
Customization:
------------------------------------------------------------------------
Keep in mind the SignageStudio lite as well as its related SDK Pepper are often released with new updates, so you will lose any changes you make to your code if you overwrite it with our release builds.
To overcome this you can follow these guidelines:
1. Always be sure to override files and not modify the original source file. This is true for both CSS and JavaScript code. Simply load your version of the CSS after ours to apply your latest changes. HTML files can be diffed (see below).
2. Our code base is modulated and uses 100% object oriented design pattern. This allows you to sub class (aka inherit) from our classes and make your applied changes (use _.extend to mixin).
3. You can also use pre-processor scripts which replace code segments automatically using directives.
4. And finally, even while following steps 1-3 you may find that your code is broken due to design changes in the original repository. That’s when GitHub comes to the rescue. When your fork the source repository, you can always merge the tree onto your forked project. Use source control diff tool to merge the changes into your code and resolve any conflicts.
With the above steps you can ensure that your source code is fully customizable while still keeping it synchronized with our ongoing development efforts.
And if you built something wonderful, just send us a pull request so we check it out.
If we like what you did we we will merge it into our code base, so you will always receive it when you fetch our changes.
If you are not a developer you can hire professional, inexpensive help from sites like oDesk and Freelancer.
Since Angular is an opinionated framework, any developer who is verse in Angular, will be able to quickly customize a solution for your own business logic.
Videos:
------------------------------------------------------------------------
[](https://www.youtube.com/watch?v=Znti-QVDjvg&feature=youtu.be "Advanced angular tips and tricks")
previous version:
------------------------------------------------------------------------
If you are looking for the previous version of StudioLite which was developed using BackboneJS, go to the branch:
- https://github.com/born2net/studio-lite/tree/studiolite-backbone
License:
------------------------------------------------------------------------
The SignageStudio Web Lite and Pepper SDK are available under GPL
- V3 https://github.com/born2net/studio-lite/blob/master/LICENSE
================================================
FILE: dev/notes.txt
================================================
////////////// NOTES ////////////////
need to find a way to remove core-js from videoangular definitions
sed -i.bak '/core-js/d' './node_modules/videogular2/src/core/vg-media/i-playable.d.ts ; sed -i.bak '/core-js/d' './node_modules/videogular2/src/core/services/vg-api.d.ts'
reload video:
https://github.com/videogular/videogular2/issues/442
npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli@latest
OR
npm install -g @angular/cli@1.2.6
npm install -g @angular/cli@8.0.2
Local project package:
rm -rf node_modules dist # use rmdir on Windows
npm install --save-dev @angular/cli@latest <<<<<<<<<<<<<<<<
npm install
ng init --ng4
==================================================================================================================
------------------------------------
>>> switch to StudioLite global env:
------------------------------------
nvm use 6.16.0 ; node --version;
rm -r -f /cygdrive/c/Program\ Files/nodejs/node_modules/typescript;
cp -r -f /cygdrive/c/Program\ Files/nodejs/node_modules/typescript-2.4.2/ /cygdrive/c/Program\ Files/nodejs/node_modules/typescript;
npm remove -g @angular/cli ; npm install -g @angular/cli@1.2.4;
------------------------------------
>>> switch to latest global env:
------------------------------------
nvm use 10.15.0 ; node --version;
rm -r -f /cygdrive/c/Program\ Files/nodejs/node_modules/typescript;
cp -r -f /cygdrive/c/Program\ Files/nodejs/node_modules/typescript-3.5.1/ /cygdrive/c/Program\ Files/nodejs/node_modules/typescript;
npm remove -g @angular/cli ; npm install -g @angular/cli@8.0.2;
==================================================================================================================
debug sessions:
reflection:
http://127.0.0.1:8080/src/create_reflection.html
local:
http://localhost:4208/
campaigns:
http://localhost:4208/campaigns
FasterqRemoteStatus (base64):
http://localhost:4208/index.html?mode=remoteStatus¶m=eyJjYWxsX3R5cGUiOiJFTUFJTCIsInNlcnZpY2VfaWQiOjE5LCJ2ZXJpZmljYXRpb24iOjY5NSwibGluZV9pZCI6IjIxMTAiLCJsaW5lX25hbWUiOiIgbmV3IGxpbmUgMSIsImJ1c2luZXNzX2lkIjoiMzU4NjEzIiwic21zIjoiIiwiZW1haWwiOiJib3JuMm5ldEBnbWFpbC5jb20iLCJkYXRlIjoiNC83LzIwMTcifQ==
FasterqTerminal (rc4):
http://localhost:4208/index.html?data=5b6bcb27d4547657cfe4e021e1c6761fe8b4a33c3d62983ee8f6b0ccbded7b8a6578e47862f0aca0ca7ac070a1a27121fe17f5c496483ee08cf0a061440f277a3e49dcaaf3bb198c71033ed398d60166e3b82c9153f4c3a6d346f7d11b3016
auto-login local demo_lite
http://localhost:4208/index.html?param=dXNlcj1kZW1vX2xpdGVAbXMuY29tLHBhc3M9cGFzc3dvcmQ=
auto-login remote demo_lite
https://secure.digitalsignage.com/studioweb/index.html?param=dXNlcj1kZW1vX2xpdGVAbXMuY29tLHBhc3M9cGFzc3dvcmQ=
auto-login local lite22
http://localhost:4208/index.html?param=dXNlcj1saXRlMjJAbXMuY29tLHBhc3M9MTIzMTIz
auto-login local lite90
http://localhost:4208/index.html?param=dXNlcj1saXRlOTBAbXMuY29tLHBhc3M9MTIzMTIz
auto-login local lite28
http://localhost:4208/index.html?param=dXNlcj1saXRlMjhAbXMuY29tLHBhc3M9MTIzMTIz
==================================================================================================================
revert webpack ng tools: npm install --save @ngtools/webpack@1.2.4
==================================================================================================================
clear cache: npm clear cache
npm install @angular/cli@latest -g
npm install -g @angular/cli
==================================================================================================================
reflection Usage:
to run this script and generate interface sdk / msdb:
run live-server inside /cygdrive/c/msweb/studiolite
open browser to:
http://127.0.0.1:8080/src/create_reflection.html
==================================================================================================================
Switching fabric versions:
add/remove import "fabric"; from app-modules.ts
add/remove form angular-cli.json:
"../node_modules/fabric/dist/fabric.js"
or
angular-cli.json: "./libs/fabric.require1-4-12.js",
or
to load remotely:
==================================================================================================================
==================================================================================================================
for translation:
1. release_aot > to generate all ./dist files in english
2. x_translate > to create an english version of ./src/local/messages.xmb
3. develop_new_script > to generate ./src/local/hebrew.xtb from messages.xmb (use server API)
https://secure.digitalsignage.com/getLocal/he/xxx/go%20find%20me%20and%20bring%20me%20here
4. release_aot_hebrew > to create new StudioLite in hebrew and upload to specific local server dir
================================================
FILE: e2e/app.e2e-spec.ts
================================================
import { NgKitchenSinkPage } from './app.po';
describe('ng-kitchen-sink App', function() {
let page: NgKitchenSinkPage;
beforeEach(() => {
page = new NgKitchenSinkPage();
});
it('should display message saying app works', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('app works!');
});
});
================================================
FILE: e2e/app.po.ts
================================================
import { browser, element, by } from 'protractor';
export class NgKitchenSinkPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}
================================================
FILE: e2e/tsconfig.json
================================================
{
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../dist/out-tsc-e2e",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
]
}
}
================================================
FILE: examples/adStatsSample.xml
================================================
stationId,packageId,packageContentId,packageName,contentName,day,hour,counts,duration,mph,ratestationId,localContentId,day,hour,counts,duration,mph,rate14,136,3,8,9,1214.9,0.221447,014,136,3,9,14,1889.8,0.442799,014,136,3,10,14,1856.2,0.383568,014,136,3,11,14,1890.1,0.456984,014,136,3,12,14,1848.5,0.41431,014,136,3,13,13,1754.9,0.39168,014,136,3,14,14,1890.2,0.457008,014,136,3,15,14,1890.2,0.457008,014,136,3,16,14,1890.1,0.456983,014,136,3,17,14,1890,0.45696,014,136,3,18,14,1890.2,0.457008,014,136,3,19,14,1890.1,0.456984,014,136,3,20,14,1890,0.45696,014,136,3,21,14,1890.2,0.457008,014,136,3,22,15,2025.3,0.489672,014,136,3,23,14,1889.9,0.456935,014,136,4,0,14,1890.3,0.457031,014,136,4,1,14,1890.2,0.457008,014,136,4,2,14,1890.2,0.457008,014,136,4,3,14,1890.2,0.457007,014,136,4,4,14,1890.1,0.456984,014,136,4,5,14,1889.9,0.42432,014,136,4,6,14,1889.9,0.456935,014,136,4,7,14,1889.9,0.456935,014,136,4,8,14,1890.2,0.457007,014,136,4,9,14,1890,0.45696,014,136,4,10,15,2024.9,0.489575,014,136,4,11,14,1889.9,0.456935,014,136,4,12,14,1889.7,0.42427,014,136,4,13,14,1889.6,0.45686,014,136,4,14,14,1890,0.456959,014,136,4,15,14,1889.7,0.456885,014,136,4,16,14,1889.9,0.456935,014,136,4,17,14,1889.9,0.456935,014,136,4,18,14,1890,0.45696,014,136,4,19,15,2024.9,0.489575,014,136,4,20,14,1889.9,0.456934,014,136,4,21,14,1889.9,0.456935,014,136,4,22,14,1889.8,0.45691,014,136,4,23,14,1889.9,0.456935,014,136,5,0,14,1889.9,0.456935,014,136,5,1,14,1890.2,0.457008,014,136,5,2,14,1890.2,0.457008,014,136,5,3,14,1890,0.456959,014,136,5,4,14,1889.7,0.456885,014,136,5,5,14,1890.1,0.424368,014,136,5,6,14,1890,0.45696,014,136,5,7,14,1890,0.45696,014,136,5,8,13,1716.2,0.349707,014,136,5,9,14,1890.2,0.457008,014,136,5,10,9,1215.3,0.293832,014,136,7,12,2,27.4,0,014,136,7,13,13,1756.2,0.391992,014,136,7,14,14,1891.8,0.457392,014,136,7,15,15,2026.4,0.489936,014,136,7,16,14,1892,0.45744,014,136,7,17,14,1892.3,0.457512,014,136,7,18,14,1891.5,0.45732,014,136,7,19,14,1891.2,0.457248,014,136,7,20,14,1891.2,0.457248,014,136,7,21,14,1891.5,0.45732,014,136,7,22,14,1891.4,0.457296,014,136,7,23,14,1891.5,0.45732,014,136,8,0,14,1891.7,0.457368,014,136,8,1,14,1891.8,0.457391,014,136,8,2,14,1891.1,0.457224,014,136,8,3,15,2026.7,0.490008,014,136,8,4,13,1756.8,0.424752,014,136,8,5,14,1889.9,0.424319,014,136,8,6,14,1889.7,0.456884,014,136,8,7,14,1890.1,0.456984,014,136,8,8,13,1755,0.391703,014,136,8,9,14,1889.8,0.45691,014,136,8,10,15,2025,0.489599,014,136,8,11,4,539.9,0.130535,014,136,8,12,9,1047.5,0.195815,014,136,8,13,2,515.1,0.124539,014,137,3,8,8,481,0.112702,014,137,3,9,15,901.5,0.21123,014,137,3,10,12,699.9,0.165785,014,137,3,11,14,841.9,0.203545,014,137,3,12,13,781.4,0.188915,014,137,3,13,13,781.4,0.188916,014,137,3,14,14,841.5,0.203446,014,137,3,15,14,841.4,0.203421,014,137,3,16,14,841.4,0.20342,014,137,3,17,15,901.8,0.218025,014,137,3,18,14,841.3,0.203397,014,137,3,19,14,841.3,0.203396,014,137,3,20,14,841.6,0.203471,014,137,3,21,14,841.3,0.203396,014,137,3,22,14,841.4,0.20342,014,137,3,23,14,841.4,0.203421,014,137,4,0,14,841.3,0.203397,014,137,4,1,14,841.5,0.203447,014,137,4,2,14,841.6,0.20347,014,137,4,3,15,901.6,0.217976,014,137,4,4,14,841.4,0.203421,014,137,4,5,14,841.7,0.203495,014,137,4,6,14,841.4,0.20342,014,137,4,7,14,841.4,0.20342,014,137,4,8,14,841.3,0.203396,014,137,4,9,14,841.3,0.203396,014,137,4,10,14,841.3,0.203396,014,137,4,11,14,841.4,0.20342,014,137,4,12,14,813.4,0.196651,014,137,4,13,14,841.3,0.203396,014,137,4,14,15,901.2,0.217878,014,137,4,15,14,841.3,0.203396,014,137,4,16,14,841.4,0.20342,014,137,4,17,14,841.3,0.203396,014,137,4,18,14,841.2,0.203372,014,137,4,19,14,841.4,0.20342,014,137,4,20,14,841.3,0.203396,014,137,4,21,14,841.2,0.203372,014,137,4,22,14,840.9,0.2033,014,137,4,23,14,841.3,0.203396,014,137,5,0,15,901.3,0.217902,014,137,5,1,14,841.4,0.20342,014,137,5,2,14,841.2,0.203372,014,137,5,3,14,841.4,0.203421,014,137,5,4,14,841.4,0.20342,014,137,5,5,13,781.3,0.18889,014,137,5,6,15,901.4,0.217926,014,137,5,7,14,841.2,0.203372,014,137,5,8,11,637.2,0.154052,014,137,5,9,14,841.3,0.203396,014,137,5,10,9,540.9,0.13077,014,137,7,13,13,782.8,0.18926,014,137,7,14,14,843.1,0.203841,014,137,7,15,14,842.7,0.203742,014,137,7,16,14,842.8,0.203765,014,137,7,17,14,842.7,0.203741,014,137,7,18,14,842.3,0.203643,014,137,7,19,14,842.8,0.203765,014,137,7,20,14,843.1,0.203839,014,137,7,21,15,904,0.218564,014,137,7,22,14,842.6,0.203717,014,137,7,23,14,842.7,0.203741,014,137,8,0,14,842.5,0.203693,014,137,8,1,14,842.9,0.203792,014,137,8,2,14,842.3,0.203642,014,137,8,3,14,842.8,0.203767,014,137,8,4,14,842.1,0.203595,014,137,8,5,14,841.4,0.20342,014,137,8,6,14,841.4,0.20342,014,137,8,7,14,841.3,0.203396,014,137,8,8,13,781.2,0.188866,014,137,8,9,14,841.4,0.20342,014,137,8,10,14,841.4,0.20342,014,137,8,11,5,300.5,0.07265,014,137,8,12,6,360.6,0.08718,014,137,8,13,1,60.1,0.01453,014,138,3,8,7,420.7,0.098574,014,138,3,9,14,841.3,0.197123,014,138,3,10,12,721.4,0.170824,014,138,3,11,14,841.6,0.20347,014,138,3,12,13,781.5,0.18894,014,138,3,13,13,781.3,0.18889,014,138,3,14,14,841.4,0.203421,014,138,3,15,14,841.6,0.20347,014,138,3,16,14,841.7,0.203495,014,138,3,17,14,841.4,0.20342,014,138,3,18,14,841.6,0.203471,014,138,3,19,15,901.8,0.218025,014,138,3,20,14,841.6,0.20347,014,138,3,21,14,841.5,0.203446,014,138,3,22,14,841.4,0.20342,014,138,3,23,14,841.4,0.203421,014,138,4,0,14,841.6,0.20347,014,138,4,1,14,841.3,0.203397,014,138,4,2,14,841.4,0.20342,014,138,4,3,14,841.3,0.203396,014,138,4,4,14,841.4,0.203421,014,138,4,5,13,781.4,0.188915,014,138,4,6,14,841.2,0.203373,014,138,4,7,14,841.5,0.203445,014,138,4,8,15,901.6,0.217975,014,138,4,9,14,841.4,0.20342,014,138,4,10,14,841.4,0.203421,014,138,4,11,14,841.4,0.20342,014,138,4,12,13,781.2,0.188866,014,138,4,13,14,841.3,0.203396,014,138,4,14,14,841.4,0.20342,014,138,4,15,14,841.3,0.203396,014,138,4,16,14,841.4,0.203421,014,138,4,17,15,901.7,0.218,014,138,4,18,14,841.4,0.20342,014,138,4,19,14,841.4,0.20342,014,138,4,20,14,841.4,0.20342,014,138,4,21,14,841.4,0.203421,014,138,4,22,14,841.4,0.20342,014,138,4,23,14,841.2,0.203372,014,138,5,0,14,841.6,0.20347,014,138,5,1,14,841.3,0.203396,014,138,5,2,14,841.4,0.20342,014,138,5,3,15,901.5,0.217952,014,138,5,4,14,841.5,0.203445,014,138,5,5,13,781.2,0.188866,014,138,5,6,14,841.4,0.20342,014,138,5,7,14,841.5,0.203445,014,138,5,8,11,661.2,0.159855,014,138,5,9,14,841.6,0.20347,014,138,5,10,9,541,0.130795,014,138,7,13,13,782.7,0.189236,014,138,7,14,14,842.8,0.203766,014,138,7,15,14,843.1,0.203838,014,138,7,16,14,842.9,0.20379,014,138,7,17,14,842.5,0.203693,014,138,7,18,14,843.3,0.203888,014,138,7,19,14,842.9,0.203791,014,138,7,20,14,843.1,0.203841,014,138,7,21,14,843,0.203814,014,138,7,22,14,843.2,0.203865,014,138,7,23,14,843,0.203815,014,138,8,0,15,902.7,0.218248,014,138,8,1,14,842.4,0.203669,014,138,8,2,14,843.1,0.203837,014,138,8,3,14,842.4,0.203667,014,138,8,4,14,842.8,0.203766,014,138,8,5,13,781.1,0.188842,014,138,8,6,14,841.4,0.20342,014,138,8,7,14,841.4,0.203421,014,138,8,8,14,793.3,0.191791,014,138,8,9,14,841.3,0.203397,014,138,8,10,14,841.5,0.203445,014,138,8,11,4,240.4,0.05812,014,138,8,12,6,360.8,0.08723,014,138,8,13,1,60.1,0.01453,018,136,2,15,2,269.9,0.06324,018,136,2,16,1,134.9,0.031608,018,137,2,15,1,60,0.014058,018,137,2,16,2,120.1,0.02814,018,138,2,15,2,120.1,0.02814,018,138,2,16,2,120,0.028116,019,136,3,12,1,134.9,0,019,136,3,13,14,1398.6,0.156452,019,136,3,16,2,270.3,0.032736,019,136,4,13,7,9960.4,2.301675,019,137,3,12,1,66.1,0.015981,019,137,3,13,5,304.1,0.073522,019,137,3,16,1,60.5,0.014627,019,137,4,13,4,244.5,0.059113,019,138,3,12,1,93.9,0.022702,019,138,3,13,5,303.3,0.073329,019,138,3,16,1,61.2,0.014796,019,138,4,13,4,185.6,0.044872,0
================================================
FILE: examples/apps_table.txt
================================================
app_id app_name help_name description uninstallable hidden price min_version
10005 Embeded Resource "" Embeded Resource False True 0 4.12
10010 Scene "" Scene False True 0 4.12
10020 External Resource "" External Resource False False 0 4.12
10030 Label "" Label False False 0 4.12
10040 Html "" Html False False 0 4.12
10050 Rss Text "" Rss Text False False 0 4.12
10060 Custom Rss "" Custom Rss False False 0 4.12
10070 Media Rss/Podcast "" Media Rss/Podcast False False 0 4.12
10080 Weather "" Weather False False 0 4.12
10090 Stock "" Stock False False 0 4.12
10100 Catalog "" Catalog False False 0 4.12
10110 Capture/Camera "" Capture/Camera True False 0 4.12
10120 Clock "" Clock True False 0 4.12
10122 Countdown "" Countdown True False 0 4.12
10130 Grid/Chart "" Grid/Chart True False 0 4.12
10140 Ext Application "" Ext Application True False 0 4.12
10145 Webkit "" Webkit True False 0 4.33
10150 Advertising "" Advertising True False 0 4.12
10160 QR Code "" QR Code True False 0 4.12
10180 CollectionViewer "" CollectionViewer True False 0 4.12
10185 Location based "" Location based True False 0 4.33
10190 XML Player "" XML Player True False 0 4.12
10195 JSON Player "" JSON Player True False 0 4.33
10210 Twitter "" Twitter True False 0 4.12
10220 YouTube "" YouTube True False 0 4.12
10300 Form "" Form True False 0 4.12
10400 Message "" Message True False 0 4.12
10500 Label Queue "" Label Queue True False 0 4.15
11000 Browser "" Browser True False 0 4.33
12000 Digg "" Digg True False 0 4.33
12010 World weather "" Weather True False 0 4.33
12020 Facebook "" Facebook True False 0 4.33
12030 Google calendar "" Google calendar True False 0 4.33
12032 Google Sheets "" Google Sheets True False 0 4.33
12040 Google plus "" Google plus True False 0 4.33
12050 Picasa "" Picasa True False 0 4.33
12060 Instagram "" Instagram True False 0 4.33
12070 Google drive "" Google drive True False 0 4.33
12080 500px "" 500px True False 0 4.33
12090 Pinterest "" Pinterest True False 0 4.33
12100 FasterQ "" FasterQ True False 0 4.33
12200 Tumblr "" Tumblr True False 0 4.33
12210 Dropbox "" Dropbox True False 0 4.33
12220 Flickr "" Flickr True False 0 4.33
12230 Twitter "" Twitter True False 0 4.33
12240 Yelp "" Yelp True False 0 4.33
12250 Etsy "" Etsy True False 0 4.33
12260 Mashape "" Mashape True False 0 4.33
================================================
FILE: examples/calendar_google.xml
================================================
scene
Player
player
================================================
FILE: examples/collection.xml
================================================
================================================
FILE: examples/collection_scene.xml
================================================
================================================
FILE: examples/digg.xml
================================================
Scene:
Player:
================================================
FILE: examples/googlesheets.xml
================================================
================================================
FILE: examples/instagram_feed.xml
================================================
scene:
player:
================================================
FILE: examples/jsonItem.xml
================================================
================================================
FILE: examples/jsonPlayer.xml
================================================
================================================
FILE: examples/json_as3_maps.xml
================================================
0)
{
for each(var item:Object in m_fieldCollection.source)
{
if (item.name==BlockJsonItemPlayer(m_playerLoader.player).fieldName)
{
fieldCombo.selectedItem = item;
break;
}
}
fieldComboForm.label = "Field name";
fieldComboForm.visible = true;
fieldComboForm.height = NaN;
spreadsheetFrame.visible = false;
fieldPathForm.enabled = false;
fieldTypeForm.enabled = false;
fieldCombo.visible = true;
}
else
{
fieldComboForm.label = "Field name";
fieldComboForm.visible = false;
fieldComboForm.height = 10;
fieldPathForm.enabled = true;
fieldTypeForm.enabled = true;
fieldCombo.visible = true;
}
fontCtrl.fontItem = BlockJsonItemPlayer(m_playerLoader.player).fontItem;
for each(var fieldType:Object in ArrayList(fieldTypeCombo.dataProvider).source)
{
if (fieldType.name==BlockJsonItemPlayer(m_playerLoader.player).fieldType)
{
fieldTypeCombo.selectedItem = fieldType;
break;
}
}
updateButtons();
if (BlockJsonItemPlayer(m_playerLoader.player).fieldType=="date")
{
dateFormat.text = BlockJsonItemPlayer(m_playerLoader.player).dateFormat;
}
else if (BlockJsonItemPlayer(m_playerLoader.player).fieldType=="resource" || BlockJsonItemPlayer(m_playerLoader.player).fieldType=="object")
{
maintainAspectRatio.selected = BlockJsonItemPlayer(m_playerLoader.player).maintainAspectRatio;
}
}
private function onFieldChanged(event:Event):void
{
BlockJsonItemPlayer(m_playerLoader.player).fieldType= fieldCombo.selectedItem.type;
fieldPath.text = BlockJsonItemPlayer(m_playerLoader.player).fieldName = fieldCombo.selectedItem.name;
if (BlockJsonItemPlayer(m_playerLoader.player).fieldType=="date")
{
dateFormat.text = BlockJsonItemPlayer(m_playerLoader.player).dateFormat;
}
else if (BlockJsonItemPlayer(m_playerLoader.player).fieldType=="resource" || BlockJsonItemPlayer(m_playerLoader.player).fieldType=="object")
{
maintainAspectRatio.selected = BlockJsonItemPlayer(m_playerLoader.player).maintainAspectRatio;
}
updateButtons();
for each(var fieldType:Object in ArrayList(fieldTypeCombo.dataProvider).source)
{
if (fieldType.name==BlockJsonItemPlayer(m_playerLoader.player).fieldType)
{
fieldTypeCombo.selectedItem = fieldType;
break;
}
}
}
private function onFieldPathChanged(event:Event):void
{
BlockJsonItemPlayer(m_playerLoader.player).fieldName = fieldPath.text;
}
private function onFieldType():void
{
BlockJsonItemPlayer(m_playerLoader.player).fieldType= fieldTypeCombo.selectedItem.name;
updateButtons();
}
private function onFontChanged(event:Event):void
{
BlockJsonItemPlayer(m_playerLoader.player).fontItem = fontCtrl.fontItem;
}
private function onMaintainAspectRatio():void
{
BlockJsonItemPlayer(m_playerLoader.player).maintainAspectRatio = maintainAspectRatio.selected;
}
private function onDateFormat():void
{
BlockJsonItemPlayer(m_playerLoader.player).dateFormat = dateFormat.text;
}
private function onSpreadsheetCell():void
{
BlockJsonItemPlayer(m_playerLoader.player).fieldName = fieldPath.text = "$cells." + row.value + "." + col.value + ".value";
}
private function updateButtons():void
{
if (BlockJsonItemPlayer(m_playerLoader.player).fieldType=="text")
{
fontCtrl.visible = true;
maintainAspectRatioForm.visible = false;
dateFormatForm.visible = dateInfo.visible = false;
}
else if (BlockJsonItemPlayer(m_playerLoader.player).fieldType=="date")
{
fontCtrl.visible = true;
maintainAspectRatioForm.visible = false;
dateFormatForm.visible = dateInfo.visible = true;
}
else
{
fontCtrl.visible = false;
maintainAspectRatioForm.visible = true;
dateFormatForm.visible = dateInfo.visible = false;
}
}
]]>
Y Year YY YYYY
M Month in year M MM MMM MMM
D Day in month D DD
E Days in week E EE EEE EEEE
A AM/PM AM or PM
J Hour in Day 0-23
H Hour in Day 1-24
K Hour in am/pm 0-11
L Hour in am/pm 1-12
N Minute in hour N NN
S Seconds in minute SS
================================================
FILE: examples/json_scenes.xml
================================================
================================================
FILE: examples/jsonsheets.xml
================================================
================================================
FILE: examples/location.xml
================================================
================================================
FILE: examples/player_weather_scene.xml
================================================
================================================
FILE: examples/reseller_sample.xml
================================================
================================================
FILE: examples/sceneSample.xml
================================================
I am qr
================================================
FILE: examples/sceneSampleLayout.xml
================================================
================================================
FILE: examples/twitterv3.xml
================================================
Scene
Player
================================================
FILE: examples/worldweather.xml
================================================
================================================
FILE: notes.txt
================================================
////////////// NOTES ////////////////
need to find a way to remove core-js from videoangular definitions
sed -i.bak '/core-js/d' './node_modules/videogular2/src/core/vg-media/i-playable.d.ts ; sed -i.bak '/core-js/d' './node_modules/videogular2/src/core/services/vg-api.d.ts'
reload video:
https://github.com/videogular/videogular2/issues/442
npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli@latest
Local project package:
rm -rf node_modules dist # use rmdir on Windows
npm install --save-dev @angular/cli@latest <<<<<<<<<<<<<<<<
npm install
ng init --ng4
==================================================================================================================
debug sessions:
reflection:
http://127.0.0.1:8080/src/create_reflection.html
local:
http://localhost:4208/
campaigns:
http://localhost:4208/campaigns
FasterqRemoteStatus (base64):
http://localhost:4208/index.html?mode=remoteStatus¶m=eyJjYWxsX3R5cGUiOiJFTUFJTCIsInNlcnZpY2VfaWQiOjE5LCJ2ZXJpZmljYXRpb24iOjY5NSwibGluZV9pZCI6IjIxMTAiLCJsaW5lX25hbWUiOiIgbmV3IGxpbmUgMSIsImJ1c2luZXNzX2lkIjoiMzU4NjEzIiwic21zIjoiIiwiZW1haWwiOiJib3JuMm5ldEBnbWFpbC5jb20iLCJkYXRlIjoiNC83LzIwMTcifQ==
FasterqTerminal (rc4):
http://localhost:4208/index.html?data=5b6bcb27d4547657cfe4e021e1c6761fe8b4a33c3d62983ee8f6b0ccbded7b8a6578e47862f0aca0ca7ac070a1a27121fe17f5c496483ee08cf0a061440f277a3e49dcaaf3bb198c71033ed398d60166e3b82c9153f4c3a6d346f7d11b3016
auto-login local demo_lite
http://localhost:4208/index.html?param=dXNlcj1kZW1vX2xpdGVAbXMuY29tLHBhc3M9cGFzc3dvcmQ=
auto-login remote demo_lite
https://secure.digitalsignage.com/studioweb/index.html?param=dXNlcj1kZW1vX2xpdGVAbXMuY29tLHBhc3M9cGFzc3dvcmQ=
auto-login remote demo_lite
https://goo.gl/rru309
auto-login local lite22
http://localhost:4208/index.html?param=dXNlcj1saXRlMjJAbXMuY29tLHBhc3M9MTIzMTIz
auto-login local lite90
http://localhost:4208/index.html?param=dXNlcj1saXRlOTBAbXMuY29tLHBhc3M9MTIzMTIz
auto-login local lite28
http://localhost:4208/index.html?param=dXNlcj1saXRlMjhAbXMuY29tLHBhc3M9MTIzMTIz
==================================================================================================================
revert webpack ng tools: npm install --save @ngtools/webpack@1.2.4
==================================================================================================================
clear cache: npm clear cache
npm install @angular/cli@latest -g
npm install -g @angular/cli
==================================================================================================================
reflection Usage:
to run this script and generate interface sdk / msdb:
run live-server inside /cygdrive/c/msweb/studiolite
open browser to:
http://127.0.0.1:8080/src/create_reflection.html
==================================================================================================================
Switching fabric versions:
add/remove import "fabric"; from app-modules.ts
add/remove form angular-cli.json:
"../node_modules/fabric/dist/fabric.js"
or
angular-cli.json: "./libs/fabric.require1-4-12.js",
or
to load remotely:
==================================================================================================================
================================================
FILE: package.json
================================================
{
"name": "studioweb",
"version": "0.1.778",
"license": "Modified GPL (see readme.md)",
"angular-cli": {},
"scripts": {
"postinstall": "npm run dev",
"compodoc": "./node_modules/.bin/compodoc -p src/tsconfig.json",
"x_disk-build": "ng build && npm run sw",
"x_disk-serve": "cd dist && live-server --port=4208 --host=localhost --entry-file=/index.html",
"x_reg_release": "rm -r -f ./dist && npm run x_bump && npm run x_prod && npm run x_rsync",
"x_start": "ng serve",
"x_lint": "tslint \"src/**/*.ts\"",
"x_prod_jit": "ng build --target=production --base-href ./ --aot fiw.alse",
"x_prod_aot": "ng build --target=production --base-href ./ --aot true",
"x_prod_aot_hebrew": "ng build --locale iw -i18n-file src/locale/iw.xtb --i18n-format xtb --target=production --base-href ./ --aot true",
"x_rsync": "rsync --progress --chmod=ug=rwx --chmod=o=rx -av --stats -e ssh /cygdrive/c/msweb/studiolite/dist/ Sean@secure.digitalsignage.com:/var/www/sites/dynasite/htdocs/_msportal/_js/_node/_studioweb",
"x_rsync_docs": "rsync --progress --chmod=ug=rwx --chmod=o=rx -av --stats -e ssh /cygdrive/c/msweb/studiolite/documentation/ Sean@digitalsignage.com:/var/www/sites/mediasignage.com/htdocs/lite_docs",
"x_rsync_iw": "rsync --progress --chmod=ug=rwx --chmod=o=rx -av --stats -e ssh /cygdrive/c/msweb/studiolite/dist/ Sean@digitalsignage.com:/var/www/sites/dynasite/htdocs/_msportal/_js/_node/_studioweb/locale/iw",
"x_sw": "sw-precache --root=dist --config=sw-precache-config.js",
"x_bump": "gulp x_bump",
"x_cssDev": "gulp cssDev",
"x_cssRelease": "gulp cssRelease",
"x_translate": "node_modules/.bin/ng-xi18n -p src/tsconfig.json --i18nFormat=xmb",
"x_node_copy": "cp -r -f ./node_modules/ ./dist/out-tsc/",
"cp module": "cp ./node_modules/ng-mslib/src/myng-component.ts ./node_modules/ng-mslib/dist/",
"generate_locale": "npm run x_node_copy && npm run x_translate",
"hmr": "ng serve --port 4208 --aot false --hmr -e=hmr",
"dev": "npm run x_cssDev && ng serve --port 4208 --aot false",
"release_aot_hebrew": "npm run x_cssRelease && rm -r -f ./dist && npm run x_bump && npm run x_prod_aot_hebrew && npm run x_sw && npm run x_rsync_iw",
"release_aot": "npm run x_cssRelease && rm -r -f ./dist && npm run x_bump && npm run x_prod_aot && npm run x_sw && npm run x_rsync",
"release_aot_no_sync": "npm run x_cssRelease && rm -r -f ./dist && npm run x_bump && npm run x_prod_aot && npm run x_sw",
"release_jit": "npm run x_cssRelease && rm -r -f ./dist && npm run x_bump && npm run x_prod_jit && npm run x_sw && npm run x_rsync"
},
"dependencies": {
"@angular/animations": "^4.3.1",
"@angular/common": "^4.3.1",
"@angular/compiler": "^4.3.1",
"@angular/core": "^4.3.1",
"@angular/forms": "^4.3.1",
"@angular/http": "^4.3.1",
"@angular/platform-browser": "^4.3.1",
"@angular/platform-browser-dynamic": "^4.3.1",
"@angular/router": "^4.3.1",
"@ngrx/core": "^1.2.0",
"@ngrx/effects": "^2.0.0",
"@ngrx/store": "^2.2.1",
"@ngrx/store-devtools": "^3.2.3",
"@ngtools/webpack": "^1.2.4",
"@types/bootbox": "^4.4.30",
"@types/gsap": "1.19.0",
"@types/lodash": "^4.14.52",
"@types/xdate": "^0.8.27",
"angular-pipes": "^5.4.0",
"angular2-fontawesome": "~0.8.0",
"angular2-google-maps": "^0.17.0",
"angular2-highcharts": "^0.4.1",
"angular2-redux-util": "^0.8.86",
"angular2-uuid": "^1.1.0",
"bootbox": "^4.4.0",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"fabric": "git://github.com/born2net/fabric.js.git",
"font-awesome": "~4.7.0",
"gsap": "1.19.1",
"gulp-bump": "^2.5.1",
"hammerjs": "^2.0.8",
"immutable": "^3.8.1",
"jquery": "^3.1.1",
"lodash": "^4.17.4",
"moment": "^2.17.1",
"ng-mslib": "^1.0.109",
"ng-validators": "^0.2.1",
"ng2-bs3-modal": "^0.10.4",
"ng2-toastr": "^4.1.2",
"ngrx-store-freeze": "^0.1.6",
"ngx-bootstrap": "^1.7.1",
"ngx-color-picker": "^4.0.0",
"ngx-contextmenu": "^1.0.3",
"platform": "^1.3.3",
"primeng": "^4.0.0-rc.2",
"print-js": "^1.0.34",
"redux": "^3.6.0",
"redux-thunk": "^2.1.0",
"reselect": "^2.5.4",
"rxjs": "^5.4.2",
"stacktrace-js": "^1.3.1",
"string": "^3.3.3",
"ts-helpers": "^1.1.1",
"typescript": "2.4.0",
"videogular2": "^5.2.0",
"x2js": "^3.1.0",
"xdate": "^0.8.0",
"xml2js": "^0.4.17",
"zone.js": "^0.8.12"
},
"devDependencies": {
"@angular/cli": "^1.0.1",
"@angular/compiler-cli": "^4.3.1",
"@angular/language-service": "^4.3.1",
"@angularclass/hmr": "^1.2.2",
"@compodoc/compodoc": "^1.0.0-beta.9",
"@types/core-js": "^0.9.41",
"@types/hammerjs": "^2.0.33",
"@types/immutable": "^3.8.6",
"@types/jasmine": "2.5.38",
"@types/jquery": "^2.0.34",
"@types/node": "^6.0.42",
"@types/x2js": "0.0.27",
"autoprefixer": "^6.6.1",
"co": "^4.6.0",
"codelyzer": "~2.0.0",
"fs-extra": "^2.1.2",
"gulp": "^3.9.1",
"gulp-comment-swap": "0.0.10",
"gulp-concat": "^2.6.0",
"gulp-git": "^1.6.0",
"gulp-inject": "^1.3.1",
"gulp-insert": "^0.5.0",
"gulp-replace": "^0.5.4",
"gulp-rimraf": "^0.2.0",
"gulp-shell": "^0.5.2",
"gulp-sourcemaps": "^1.6.0",
"gulp-tslint": "^4.3.1",
"gulp-tslint-stylish": "^1.1.1",
"gulp-typedoc": "^1.2.1",
"gulp-typescript": "^3.0.1",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.7",
"gulp-watch": "^4.2.4",
"node-fetch": "^1.6.3",
"replace": "^0.3.0",
"rsync": "^0.5.0",
"run-sequence": "^1.2.2",
"sw-precache": "4.2.1",
"ts-node": "~2.0.0",
"tslint": "~4.4.2",
"webdriver-manager": "10.2.5",
"xml2js": "^0.4.17"
}
}
================================================
FILE: src/Lib.ts
================================================
/** Common Library **/
import {Injectable} from "@angular/core";
import * as Immutable from "immutable";
import {List, Map} from "immutable";
import * as _ from "lodash";
import * as moment from 'moment'
import {Observable} from "rxjs";
import {PartialObserver} from "rxjs/Observer";
import {AnonymousSubscription} from "rxjs/Subscription";
import {environment} from "./environments/environment";
import {FormGroup, ValidatorFn} from "@angular/forms";
export var simpleRegExp = '[\\[\\]\\-A-Za-z0-9_~=!:@\.|\ ]{3,50}';
//(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})
export var urlRegExp = `(https?:\/\/(?:www\.|(?!www))\.*)`
/** this control value must be equal to given control's value */
export function equalValueValidator(targetKey: string, toMatchKey: string): ValidatorFn {
return (group: FormGroup): { [key: string]: any } => {
const target = group.controls[targetKey];
const toMatch = group.controls[toMatchKey];
if (target.touched && toMatch.touched) {
const isMatch = target.value === toMatch.value;
// set equal value error on dirty controls
if (!isMatch && target.valid && toMatch.valid) {
toMatch.setErrors({equalValue: targetKey});
const message = targetKey + ' != ' + toMatchKey;
return {'equalValue': message};
}
if (isMatch && toMatch.hasError('equalValue')) {
toMatch.setErrors(null);
}
}
return null;
};
}
const rxjsDebugger = true;
const rc4Key = '226a3a42f34ddd778ed2c3ba56644315';
Observable.prototype.sub = Observable.prototype.subscribe;
window['con'] = (msg, stringify) => {
if (Lib.DevMode()) {
if (stringify)
msg = JSON.stringify(msg);
console.info(`${_.uniqueId()}:${new Date().toLocaleTimeString()} ${msg}`);
}
}
declare module 'rxjs/Observable' {
interface Observable {
debug: (...any) => Observable
}
// interface Observable {
// get(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Subscription;
// }
}
declare module "rxjs/Observable" {
interface Observable {
sub: (observerOrNext: PartialObserver | ((value: T) => void),
error: (error: any) => void,
complete?: () => void) => AnonymousSubscription;
}
}
Observable.prototype.debug = function (message: string) {
return this.do(
nextValue => {
if (rxjsDebugger) {
console.debug('ObsDebug-I: ' + message, (nextValue.type || nextValue))
}
},
error => {
if (rxjsDebugger) {
console.error('ObsDebug-E: ' + message, error)
}
},
() => {
if (rxjsDebugger) {
console.debug('ObsDebug-C: ' + message);
/** for DevTools colors: **/
//console.log("%cObsDebug-C %s", "color: red", message);
}
}
);
};
@Injectable()
export class Lib {
static Con(msg: any, stringify?: boolean) {
con(msg, stringify)
}
/**
*
* @param dateString format of date + time: /Date(1469923200000+0000)/"
* @returns {any}
* @constructor
*/
static ProcessDateField(dateString: string, addDay: boolean = false): any {
if (_.isUndefined(dateString))
return '';
var epoc = dateString.match(/Date\((.*)\)/)
if (epoc[1]) {
var date = epoc[1].split('+')[0]
var time = epoc[1].split('+')[1]
var result;
//todo: adding +1 on save to server hack, need to ask Alon
if (addDay) {
result = moment(Number(date)).add(1, 'day');
} else {
result = moment(Number(date));
}
return moment(result).format('YYYY-MM-DD');
/** moment examples
var a = moment().unix().format()
console.log(moment.now());
console.log(moment().format('dddd'));
console.log(moment().startOf('day').fromNow());
**/
}
}
static ToValidNumber(i_value): number {
if (_.isNaN(i_value))
return 0;
if (_.isNumber(i_value))
return i_value;
return 0;
}
static Try(i_fn: () => void) {
try {
i_fn();
} catch (e) {
if (Lib.DevMode())
console.error('Lib.Try exception in function: ' + i_fn + ' ' + e);
}
}
/** deep compare two objects **/
static IsEqual(obj1, obj2) {
function _equals(obj1, obj2) {
var clone = $.extend(true, {}, obj1);
var cloneStr = JSON.stringify(clone);
return cloneStr === JSON.stringify($.extend(true, clone, obj2));
}
return _equals(obj1, obj2) && _equals(obj2, obj1);
}
static GetThemeColor() {
var light = true;
if (light)
return '#428ac9 ';
return '#eb7c66';
}
static EncryptUserPass(i_user, i_pass) {
var rc4 = new RC4(rc4Key);
var crumb = i_user + ':SignageStudioLite:' + i_pass + ':' + ' USER'
return rc4.doEncrypt(crumb);
}
static AlertOnLeave() {
if (!Lib.DevMode()) {
window.onbeforeunload = function (e) {
var message = "Did you save your changes?",
e = e || window.event;
// For IE and Firefox
if (e) {
e.returnValue = message;
}
// For Safari
return message;
};
}
}
/**
Format a seconds value into an object broken into hours / minutes / seconds
@method formatSecondsToObject
@param {Number} i_totalSeconds
@return {Object}
**/
static FormatSecondsToObject(i_totalSeconds) {
var seconds: any = 0;
var minutes: any = 0;
var hours: any = 0;
var totalInSeconds = i_totalSeconds;
if (i_totalSeconds >= 3600) {
hours = Math.floor(i_totalSeconds / 3600);
i_totalSeconds = i_totalSeconds - (hours * 3600);
}
if (i_totalSeconds >= 60) {
minutes = Math.floor(i_totalSeconds / 60);
seconds = i_totalSeconds - (minutes * 60);
}
if (hours == 0 && minutes == 0)
seconds = i_totalSeconds;
var playbackLength = {
hours: parseInt(hours),
minutes: parseInt(minutes),
seconds: parseInt(seconds),
totalInSeconds: parseInt(totalInSeconds)
};
return playbackLength;
}
/**
*
* @param dateString format of date + time: /Date(1469923200000+0000)/"
* @returns {any}
* @constructor
*/
static ProcessDateFieldToUnix(dateString: string, addDay: boolean = false): any {
if (_.isUndefined(dateString))
return '';
//todo: adding +1 on save to server hack, need to ask Alon
if (addDay) {
return moment(dateString, 'YYYY-MM-DD').add(0, 'day').valueOf();
} else {
return moment(dateString, 'YYYY-MM-DD').valueOf();
}
}
/**
Pad zeros
@method padZeros
@param {Number} n value
@param {Number} width pre-pad width
@param {Number} z negative as in '-'
@return {Number} zero padded string
**/
static PadZeros(n, width, z) {
z = z || '0';
n = n + '';
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
}
/**
Convert number or string to float with double precision
@method parseToFloatDouble
@param {Object} i_value
@return {Number}
**/
static ParseToFloatDouble(i_value: any): number {
return parseFloat(parseFloat(i_value).toFixed(2));
}
/**
Capitilize first letter
@method capitaliseFirst
@param {String} string
@return {String} string
**/
static CapitaliseFirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
}
/**
base64Encode
@method base64Encode
@param {String}
@return {String}
**/
static Base64Encode(str) {
var c1, c2, c3;
var Base64 = {
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", encode: function (e) {
var t = "";
var n, r, i, s, o, u, a;
var f = 0;
e = Base64._utf8_encode(e);
while (f < e.length) {
n = e.charCodeAt(f++);
r = e.charCodeAt(f++);
i = e.charCodeAt(f++);
s = n >> 2;
o = (n & 3) << 4 | r >> 4;
u = (r & 15) << 2 | i >> 6;
a = i & 63;
if (isNaN(r)) {
u = a = 64
} else if (isNaN(i)) {
a = 64
}
t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a)
}
return t
}, decode: function (e) {
var t = "";
var n, r, i;
var s, o, u, a;
var f = 0;
e = e.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (f < e.length) {
s = this._keyStr.indexOf(e.charAt(f++));
o = this._keyStr.indexOf(e.charAt(f++));
u = this._keyStr.indexOf(e.charAt(f++));
a = this._keyStr.indexOf(e.charAt(f++));
n = s << 2 | o >> 4;
r = (o & 15) << 4 | u >> 2;
i = (u & 3) << 6 | a;
t = t + String.fromCharCode(n);
if (u != 64) {
t = t + String.fromCharCode(r)
}
if (a != 64) {
t = t + String.fromCharCode(i)
}
}
t = Base64._utf8_decode(t);
return t
}, _utf8_encode: function (e) {
e = e.replace(/\r\n/g, "\n");
var t = "";
for (var n = 0; n < e.length; n++) {
var r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r)
} else if (r > 127 && r < 2048) {
t += String.fromCharCode(r >> 6 | 192);
t += String.fromCharCode(r & 63 | 128)
} else {
t += String.fromCharCode(r >> 12 | 224);
t += String.fromCharCode(r >> 6 & 63 | 128);
t += String.fromCharCode(r & 63 | 128)
}
}
return t
}, _utf8_decode: function (e) {
var t = "";
var n = 0;
var r = c1 = c2 = 0;
while (n < e.length) {
r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r);
n++
} else if (r > 191 && r < 224) {
c2 = e.charCodeAt(n + 1);
t += String.fromCharCode((r & 31) << 6 | c2 & 63);
n += 2
} else {
c2 = e.charCodeAt(n + 1);
c3 = e.charCodeAt(n + 2);
t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
n += 3
}
}
return t
}
}
return Base64.encode(str);
}
/**
base64Decode
@method base64Decode
@param {String}
@return {String}
**/
static Base64Decode(str) {
var c1, c2, c3;
var Base64 = {
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", encode: function (e) {
var t = "";
var n, r, i, s, o, u, a;
var f = 0;
e = Base64._utf8_encode(e);
while (f < e.length) {
n = e.charCodeAt(f++);
r = e.charCodeAt(f++);
i = e.charCodeAt(f++);
s = n >> 2;
o = (n & 3) << 4 | r >> 4;
u = (r & 15) << 2 | i >> 6;
a = i & 63;
if (isNaN(r)) {
u = a = 64
} else if (isNaN(i)) {
a = 64
}
t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a)
}
return t
}, decode: function (e) {
var t = "";
var n, r, i;
var s, o, u, a;
var f = 0;
e = e.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (f < e.length) {
s = this._keyStr.indexOf(e.charAt(f++));
o = this._keyStr.indexOf(e.charAt(f++));
u = this._keyStr.indexOf(e.charAt(f++));
a = this._keyStr.indexOf(e.charAt(f++));
n = s << 2 | o >> 4;
r = (o & 15) << 4 | u >> 2;
i = (u & 3) << 6 | a;
t = t + String.fromCharCode(n);
if (u != 64) {
t = t + String.fromCharCode(r)
}
if (a != 64) {
t = t + String.fromCharCode(i)
}
}
t = Base64._utf8_decode(t);
return t
}, _utf8_encode: function (e) {
e = e.replace(/\r\n/g, "\n");
var t = "";
for (var n = 0; n < e.length; n++) {
var r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r)
} else if (r > 127 && r < 2048) {
t += String.fromCharCode(r >> 6 | 192);
t += String.fromCharCode(r & 63 | 128)
} else {
t += String.fromCharCode(r >> 12 | 224);
t += String.fromCharCode(r >> 6 & 63 | 128);
t += String.fromCharCode(r & 63 | 128)
}
}
return t
}, _utf8_decode: function (e) {
var t = "";
var n = 0;
var r = c1 = c2 = 0;
while (n < e.length) {
r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r);
n++
} else if (r > 191 && r < 224) {
c2 = e.charCodeAt(n + 1);
t += String.fromCharCode((r & 31) << 6 | c2 & 63);
n += 2
} else {
c2 = e.charCodeAt(n + 1);
c3 = e.charCodeAt(n + 2);
t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
n += 3
}
}
return t
}
}
return Base64.decode(str);
}
/**
Simplify a string to basic character set
@method cleanChar
@param {String} value
@return {String} cleaned string
**/
static CleanChar(value) {
if (value == null)
value = '';
if ($.isNumeric(value))
return value;
value = value.replace(/,/g, ' ');
value = value.replace(/\\}/g, ' ');
value = value.replace(/{/g, ' ');
value = value.replace(/"/g, ' ');
value = value.replace(/'/g, ' ');
value = value.replace(/&/g, 'and');
value = value.replace(/>/g, ' ');
value = value.replace(//ig, ")");
}
case 3: {
i_string = i_string.replace(/&/ig, "and");
}
case 4: {
i_string = i_string.replace(/"/ig, "`");
i_string = i_string.replace(/'/ig, "`");
}
}
return i_string;
}
static IsNumber(value) {
if (_.isNaN(Number(value))) return false;
return true;
}
static CleanCharForXml(value: any): any {
var clean = function (value: string) {
if (_.isUndefined(value))
return '';
if (_.isNull(value))
return '';
if (_.isNumber(value))
return value;
if (_.isBoolean(value))
return value;
value = value.replace(/\}/g, ' ');
value = value.replace(/%/g, ' ');
value = value.replace(/{/g, ' ');
value = value.replace(/"/g, '`');
value = value.replace(/'/g, '`');
value = value.replace(/&/g, 'and');
value = value.replace(/>/g, ' ');
value = value.replace(/ {
// currently we don't support / clean arrays
if (_.isArray(value[k]))
return value[k] = v;
value[k] = clean(v);
});
return value;
}
static UnionList(a: List, b: List) {
return a.toSet().union(b.toSet()).toList();
}
static ProcessHourStartEnd(value: string, key: string): any {
if (_.isUndefined(!value))
return '';
if (key == 'hourStart')
return `${value}:00`;
return `${value}:59`;
}
/**
* CheckFoundIndex will check if a return value is -1 and error out if in dev mode (list.findIndex or indexOf for example)
* @param i_value
* @param i_message
* @returns {number}
* @constructor
*/
static CheckFoundIndex(i_value: number, i_message: string = 'CheckFoundIndex did not find index'): number {
if (i_value === -1) {
console.log(i_message);
if (Lib.DevMode()) {
alert(i_message);
throw Error(i_message);
}
}
return i_value;
}
// static GetCompSelector(i_constructor) {
// return 'need to fix 2';
// if (!Lib.DevMode())
// return;
// var annotations = Reflect.getMetadata('annotations', i_constructor);
// var componentMetadata = annotations.find(annotation => {
// return (annotation instanceof Component);
// });
// return componentMetadata.selector;
// }
static BootboxHide(i_time = 1500) {
setTimeout(() => {
bootbox.hideAll();
}, i_time)
}
static DateToAbsolute(year, month) {
return year * 12 + month;
}
static DateFromAbsolute(value: number) {
var year = Math.floor(value / 12);
var month = value % 12 + 1;
return {
year,
month
}
}
static MapOfIndex(map: Map, index: number, position: "first" | "last"): string {
var mapJs = map.toJS();
var mapJsPairs = _.toPairs(mapJs);
var offset = position == 'first' ? 0 : 1;
if (mapJsPairs[index] == undefined)
return "0"
return mapJsPairs[index][offset];
}
/**
* PrivilegesXmlTemplate will generate a template for priveleges in 2 possible modes
*
* mode 1: just a raw template (we will ignore the values set) and this is the mode when
* no selPrivName and appStore params are given
*
* mode 2: is when we actually serialize data to save to server and in this mode we do pass
* in the selPrivName and appStore which we use to retrieve current values from user appStore
* and generate the final XML to save to server
*
* @param selPrivName
* @param appStore
* @param callBack
* @constructor
*/
static Base64() {
var _PADCHAR = "=", _ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", _VERSION = "1.0";
function _getbyte64(s, i) {
// This is oddly fast, except on Chrome/V8.
// Minimal or no improvement in performance by using a
// object with properties mapping chars to value (eg. 'A': 0)
var idx = _ALPHA.indexOf(s.charAt(i));
if (idx === -1) {
throw "Cannot decode base64";
}
return idx;
}
function _decode(s) {
var pads = 0, i, b10, imax = s.length, x = [];
s = String(s);
if (imax === 0) {
return s;
}
if (imax % 4 !== 0) {
throw "Cannot decode base64";
}
if (s.charAt(imax - 1) === _PADCHAR) {
pads = 1;
if (s.charAt(imax - 2) === _PADCHAR) {
pads = 2;
}
// either way, we want to ignore this last block
imax -= 4;
}
for (i = 0; i < imax; i += 4) {
b10 = ( _getbyte64(s, i) << 18 ) | ( _getbyte64(s, i + 1) << 12 ) | ( _getbyte64(s, i + 2) << 6 ) | _getbyte64(s, i + 3);
x.push(String.fromCharCode(b10 >> 16, ( b10 >> 8 ) & 0xff, b10 & 0xff));
}
switch (pads) {
case 1:
b10 = ( _getbyte64(s, i) << 18 ) | ( _getbyte64(s, i + 1) << 12 ) | ( _getbyte64(s, i + 2) << 6 );
x.push(String.fromCharCode(b10 >> 16, ( b10 >> 8 ) & 0xff));
break;
case 2:
b10 = ( _getbyte64(s, i) << 18) | ( _getbyte64(s, i + 1) << 12 );
x.push(String.fromCharCode(b10 >> 16));
break;
}
return x.join("");
}
function _getbyte(s, i) {
var x = s.charCodeAt(i);
if (x > 255) {
throw "INVALID_CHARACTER_ERR: DOM Exception 5";
}
return x;
}
function _encode(s) {
if (arguments.length !== 1) {
throw "SyntaxError: exactly one argument required";
}
s = String(s);
var i, b10, x = [], imax = s.length - s.length % 3;
if (s.length === 0) {
return s;
}
for (i = 0; i < imax; i += 3) {
b10 = ( _getbyte(s, i) << 16 ) | ( _getbyte(s, i + 1) << 8 ) | _getbyte(s, i + 2);
x.push(_ALPHA.charAt(b10 >> 18));
x.push(_ALPHA.charAt(( b10 >> 12 ) & 0x3F));
x.push(_ALPHA.charAt(( b10 >> 6 ) & 0x3f));
x.push(_ALPHA.charAt(b10 & 0x3f));
}
switch (s.length - imax) {
case 1:
b10 = _getbyte(s, i) << 16;
x.push(_ALPHA.charAt(b10 >> 18) + _ALPHA.charAt(( b10 >> 12 ) & 0x3F) + _PADCHAR + _PADCHAR);
break;
case 2:
b10 = ( _getbyte(s, i) << 16 ) | ( _getbyte(s, i + 1) << 8 );
x.push(_ALPHA.charAt(b10 >> 18) + _ALPHA.charAt(( b10 >> 12 ) & 0x3F) + _ALPHA.charAt(( b10 >> 6 ) & 0x3f) + _PADCHAR);
break;
}
return x.join("");
}
return {
decode: _decode,
encode: _encode,
VERSION: _VERSION
};
}
// static LoadComponentAsync(name: string, path: string) {
//
// return System.import(path).then(c => c[name]);
//
// //return System.import('/dist/public/out.js')
// // .catch(function (e) {
// // alert('prob loading out.js ' + e);
// // }).then(function (e) {
// // alert(e);
// // alert(e[name]);
// // alert(JSON.stringify(e));
// // return System.import('App1').then(c => c[name]);
// // });
// }
static ConstructImmutableFromTable(path): Array {
var arr = [];
path.forEach((member) => {
var obj = {};
obj[member._attr.name] = {
table: {}
}
for (var k in member._attr) {
var value = member._attr[k]
obj[member._attr.name][k] = value;
for (var t in member.Tables["0"]._attr) {
var value = member.Tables["0"]._attr[t]
obj[member._attr.name]['table'][t] = value;
}
}
arr.push(Immutable.fromJS(obj));
});
return arr;
}
static ComputeMask(accessMask): number {
var bits = [1, 2, 4, 8, 16, 32, 64, 128];
var computedAccessMask = 0;
accessMask.forEach(value => {
var bit = bits.shift();
if (value) computedAccessMask = computedAccessMask + bit;
})
return computedAccessMask;
}
static ValidateEmail(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
static GetAccessMask(accessMask): List {
var checks = List();
var bits = [1, 2, 4, 8, 16, 32, 64, 128];
for (var i = 0; i < bits.length; i++) {
let checked = (bits[i] & accessMask) > 0 ? true : false;
checks = checks.push(checked)
}
return checks;
}
static GetADaysMask(accessMask): List {
var checks = List();
var bits = [1, 2, 4, 8, 16, 32, 64];
for (var i = 0; i < bits.length; i++) {
let checked = (bits[i] & accessMask) > 0 ? true : false;
checks = checks.push(checked)
}
return checks;
}
static log(msg) {
console.log(new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1") + ': ' + msg);
}
static guid(): string {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
}
/**
Smart convert color (many) to decinal
@method colorToDecimal
@param {String} color
@return {Number} decimal
**/
static ColorToDecimal(color) {
if (color.match('rgb')) {
color = this.RgbToHex(color);
return this.HexToDecimal(color)
}
return this.HexToDecimal(color);
}
static ColorToHex(color) {
if (color.match('#')) {
return color;
}
if (color.match('rgb')) {
return '#' + this.RgbToHex(color);
}
return '#' + color;
}
/**
Hex to decimal converter
@method hexToDecimal
@param {String} h
@return {Number} decimal
**/
static HexToDecimal(h) {
function hexfix(str) {
var v, w;
v = parseInt(str, 16); // in rrggbb
if (str.length == 3) {
// nybble colors - fix to hex colors
// 0x00000rgb -> 0x000r0g0b
// 0x000r0g0b | 0x00r0g0b0 -> 0x00rrggbb
w = ((v & 0xF00) << 8) | ((v & 0x0F0) << 4) | (v & 0x00F);
v = w | (w << 4);
}
return v.toString(16).toUpperCase();
}
var h = h.replace(/#/gi, '');
h = hexfix(h);
return parseInt(h, 16);
}
/**
RGB color to hex converter
@method rgbToHex
@param {Number} rgb
@return {String} hex
**/
static RgbToHex(rgb) {
function componentFromStr(numStr, percent) {
var num = Math.max(0, parseInt(numStr, 10));
return percent ?
Math.floor(255 * Math.min(100, num) / 100) : Math.min(255, num);
}
var rgbRegex = /^rgb\(\s*(-?\d+)(%?)\s*,\s*(-?\d+)(%?)\s*,\s*(-?\d+)(%?)\s*\)$/;
var result, r, g, b, hex = "";
if ((result = rgbRegex.exec(rgb))) {
r = componentFromStr(result[1], result[2]);
g = componentFromStr(result[3], result[4]);
b = componentFromStr(result[5], result[6]);
hex = (0x1000000 + (r << 16) + (g << 8) + b).toString(16).slice(1);
}
return hex;
}
/**
Decimal to hex converter
@method decimalToHex
@param {Number} d
@return {String} hex
**/
static DecimalToHex(d) {
var hex = Number(d).toString(16);
hex = "000000".substr(0, 6 - hex.length) + hex;
return hex;
}
static ReduxLoggerMiddleware = store => next => action => {
// console.log("dispatching", action.type);
let result = next(action);
//console.log("next state", store.getState());
return result
};
/**
this.ngmslibService.inDevMode() uses url localhost (window.location.href.indexOf('localhost') > -1)
while Lib.DevMode uses environment var
*/
static DevMode(): boolean {
if (environment.production) {
return false;
}
return true;
}
static GetSamples(): Object {
return {
1019: 'Sushi Restaurant,pro',
1029: 'food menu board,pro',
1007: 'Home and Garden,pro',
1009: 'Hotel Lobby,pro',
1016: 'Coffee Shop,pro',
1011: 'Hobby Shop,pro',
1013: 'Sports Bar,pro',
1014: 'Museum,pro',
1017: 'Bank,pro',
1018: 'Gas Station,pro',
1020: 'Casino,pro',
1000: 'Travel,pro',
1021: 'Bicycle Shop,pro',
1022: 'Tanning Salon,pro',
1023: 'Pharmacy,pro',
1024: 'Laser Away,pro',
1025: 'Dentistry,pro',
1026: 'Clothing store,pro',
1027: 'Golf club,pro',
1028: 'RC Heli,pro',
1030: 'seven eleven,pro',
1031: 'Subway,pro',
1032: 'Super market,pro',
1033: 'Investment Group,pro',
1035: 'Synagogue,pro',
1036: 'Dry Cleaning,pro',
1037: 'Ice Cream Shop,pro',
1038: 'Real Estate office,pro',
1039: 'Night Club,pro',
1040: 'Hockey,pro',
1041: 'Train Station,pro',
1042: 'Realtor,pro',
1043: 'Toy Store,pro',
1044: 'Indian Restaurant,pro',
1045: 'Library,pro',
1046: 'Movie Theater,pro',
1047: 'Airport,pro',
1048: 'LAX,pro',
100310: 'Motel,pro',
100301: 'Parks and Recreations,pro',
100322: 'Corner Bakery,pro',
100331: 'Retirement home,pro',
100368: 'Navy recruiting office,pro',
100397: 'Martial arts school,pro',
100414: 'Supercuts,pro',
100432: 'The UPS Store,pro',
100438: 'Cruise One,pro',
100483: 'Car service,pro',
100503: 'fedex kinkos,pro',
100510: 'veterinarian,pro',
100556: 'YMCA,pro',
100574: 'Tax services,pro',
100589: 'Wedding planner,pro',
100590: 'Cleaning services,pro',
100620: 'Pet Training,pro',
100661: 'Gymboree Kids,pro',
100677: 'Trader Joes,pro',
100695: 'Men Haircuts,pro',
100722: 'Jiffy Lube,pro',
100738: 'Toyota car dealer,pro',
100747: 'Winery,pro',
100771: 'Savings and Loans,pro',
100805: 'Nail Salon,pro',
100822: 'Weight Watchers,pro',
100899: 'Dollar Tree,pro',
100938: 'Western Bagles,pro',
100959: 'Kaiser Permanente,pro',
300143: 'Funeral home,pro',
205734: 'Church,pro',
220354: 'College,pro',
206782: 'Dr Waiting Room,pro',
300769: 'NFL Stadium,pro',
301814: 'University Campus,pro',
303038: 'Day care,pro',
304430: 'GameStop,pro',
307713: 'Del Taco,pro',
305333: 'General Hospital,pro',
305206: 'Starbucks,pro',
308283: 'training and fitness,pro',
311519: 'High school hall,pro',
309365: 'Winery,pro',
310879: 'Law Firm,pro',
1001: 'Health Club,pro',
1002: 'Gym,pro',
1003: 'Flower Shop,pro',
1004: 'Car Dealership,pro',
1012: 'Pet Shop,pro',
1005: 'Hair Salon,pro',
1209: 'Motorcycle shop,lite',
1210: 'Sushi and Grill,lite',
1211: 'the Coffee Shop,lite',
1212: 'Pizzeria,lite',
1213: 'Music Store,lite',
1214: 'Diner,lite',
1215: 'the Hair Salon,lite',
1216: 'Dentist,lite',
1203: 'Jewelry,lite',
1217: 'Crossfit,lite',
1218: 'Copy and Print shop,lite',
1219: 'Antique Store,lite',
1220: 'Clock Repair Store,lite',
1221: 'Eastern Cuisine,lite',
1222: 'the Toy Store,lite',
1223: 'Pet Store Grooming,lite',
1224: 'the Veterinarian,lite',
1225: 'Tattoo Parlor,lite',
1226: 'Camera Store,lite',
1228: 'Bike shop,lite',
1229: 'Gun Shop,lite',
1230: 'Chiropractic Clinic,lite',
1231: 'French Restaurant,lite',
1233: 'Winery,lite',
1232: 'Mexican Taqueria,lite',
1234: 'Bistro Restaurant,lite',
1235: 'Vitamin Shop,lite',
1227: 'Tailor Shop,lite',
1236: 'Computer Repair,lite',
1237: 'Car Detail,lite',
1238: 'Asian Restaurants,lite',
1239: 'Marijuana Dispensary,lite',
1240: 'the Church,lite',
1241: 'Synagogue,lite',
1242: 'Frozen Yogurt Store,lite',
1244: 'Baby Day Care,lite',
1052: 'Car wash,lite',
1053: 'Smoke shop,lite',
1054: 'Yoga place,lite',
1055: 'Laundromat,lite',
1056: 'Baby clothes,lite',
1057: 'Travel agency,lite',
1058: 'Real Estate agent,lite'
}
}
static Xml2Json() {
//https://github.com/metatribal/xmlToJSON
var xmlToJSON = (function () {
this.version = "1.3";
var options = { // set up the default options
mergeCDATA: true, // extract cdata and merge with text
grokAttr: true, // convert truthy attributes to boolean, etc
grokText: true, // convert truthy text/attr to boolean, etc
normalize: true, // collapse multiple spaces to single space
xmlns: true, // include namespaces as attribute in output
namespaceKey: '_ns', // tag name for namespace objects
textKey: '_text', // tag name for text nodes
valueKey: '_value', // tag name for attribute values
attrKey: '_attr', // tag for attr groups
cdataKey: '_cdata', // tag for cdata nodes (ignored if mergeCDATA is true)
attrsAsObject: true, // if false, key is used as prefix to name, set prefix to '' to merge children and attrs.
stripAttrPrefix: true, // remove namespace prefixes from attributes
stripElemPrefix: true, // for elements of same name in diff namespaces, you can enable namespaces and access the nskey property
childrenAsArray: true // force children into arrays
};
var prefixMatch: any = new RegExp('(?!xmlns)^.*:/');
var trimMatch: any = new RegExp('^\s+|\s+$g');
this.grokType = function (sValue) {
if (/^\s*$/.test(sValue)) {
return null;
}
if (/^(?:true|false)$/i.test(sValue)) {
return sValue.toLowerCase() === "true";
}
if (isFinite(sValue)) {
return parseFloat(sValue);
}
return sValue;
};
this.parseString = function (xmlString, opt) {
return this.parseXML(this.stringToXML(xmlString), opt);
}
this.parseXML = function (oXMLParent, opt) {
// initialize options
for (var key in opt) {
options[key] = opt[key];
}
var vResult = {}, nLength = 0, sCollectedTxt = "";
// parse namespace information
if (options.xmlns && oXMLParent.namespaceURI) {
vResult[options.namespaceKey] = oXMLParent.namespaceURI;
}
// parse attributes
// using attributes property instead of hasAttributes method to support older browsers
if (oXMLParent.attributes && oXMLParent.attributes.length > 0) {
var vAttribs = {};
for (nLength; nLength < oXMLParent.attributes.length; nLength++) {
var oAttrib = oXMLParent.attributes.item(nLength);
vContent = {};
var attribName = '';
if (options.stripAttrPrefix) {
attribName = oAttrib.name.replace(prefixMatch, '');
} else {
attribName = oAttrib.name;
}
if (options.grokAttr) {
vContent[options.valueKey] = this.grokType(oAttrib.value.replace(trimMatch, ''));
} else {
vContent[options.valueKey] = oAttrib.value.replace(trimMatch, '');
}
if (options.xmlns && oAttrib.namespaceURI) {
vContent[options.namespaceKey] = oAttrib.namespaceURI;
}
if (options.attrsAsObject) { // attributes with same local name must enable prefixes
vAttribs[attribName] = vContent;
} else {
vResult[options.attrKey + attribName] = vContent;
}
}
if (options.attrsAsObject) {
vResult[options.attrKey] = vAttribs;
} else {
}
}
// iterate over the children
if (oXMLParent.hasChildNodes()) {
for (var oNode, sProp, vContent, nItem = 0; nItem < oXMLParent.childNodes.length; nItem++) {
oNode = oXMLParent.childNodes.item(nItem);
if (oNode.nodeType === 4) {
if (options.mergeCDATA) {
sCollectedTxt += oNode.nodeValue;
} else {
if (vResult.hasOwnProperty(options.cdataKey)) {
if (vResult[options.cdataKey].constructor !== Array) {
vResult[options.cdataKey] = [vResult[options.cdataKey]];
}
vResult[options.cdataKey].push(oNode.nodeValue);
} else {
if (options.childrenAsArray) {
vResult[options.cdataKey] = [];
vResult[options.cdataKey].push(oNode.nodeValue);
} else {
vResult[options.cdataKey] = oNode.nodeValue;
}
}
}
} /* nodeType is "CDATASection" (4) */ else if (oNode.nodeType === 3) {
sCollectedTxt += oNode.nodeValue;
} /* nodeType is "Text" (3) */ else if (oNode.nodeType === 1) { /* nodeType is "Element" (1) */
if (nLength === 0) {
vResult = {};
}
// using nodeName to support browser (IE) implementation with no 'localName' property
if (options.stripElemPrefix) {
sProp = oNode.nodeName.replace(prefixMatch, '');
} else {
sProp = oNode.nodeName;
}
vContent = xmlToJSON.parseXML(oNode);
if (vResult.hasOwnProperty(sProp)) {
if (vResult[sProp].constructor !== Array) {
vResult[sProp] = [vResult[sProp]];
}
vResult[sProp].push(vContent);
} else {
if (options.childrenAsArray) {
vResult[sProp] = [];
vResult[sProp].push(vContent);
} else {
vResult[sProp] = vContent;
}
nLength++;
}
}
}
} else if (!sCollectedTxt) { // no children and no text, return null
if (options.childrenAsArray) {
vResult[options.textKey] = [];
vResult[options.textKey].push(null);
} else {
vResult[options.textKey] = null;
}
}
if (sCollectedTxt) {
if (options.grokText) {
var value = this.grokType(sCollectedTxt.replace(trimMatch, ''));
if (value !== null && value !== undefined) {
vResult[options.textKey] = value;
}
} else if (options.normalize) {
vResult[options.textKey] = sCollectedTxt.replace(trimMatch, '').replace(/\s+/g, " ");
} else {
vResult[options.textKey] = sCollectedTxt.replace(trimMatch, '');
}
}
return vResult;
}
// Convert xmlDocument to a string
// Returns null on failure
this.xmlToString = function (xmlDoc) {
try {
var xmlString = xmlDoc.xml ? xmlDoc.xml : (new XMLSerializer()).serializeToString(xmlDoc);
return xmlString;
} catch (err) {
console.log('error ' + err);
return null;
}
}
// Convert a string to XML Node Structure
// Returns null on failure
this.stringToXML = function (xmlString) {
try {
var xmlDoc = null;
if (window['DOMParser']) {
var parser = new DOMParser();
xmlDoc = parser.parseFromString(xmlString, "text/xml");
return xmlDoc;
} else {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.loadXML(xmlString);
return xmlDoc;
}
} catch (e) {
console.log('error stringToXML ' + e);
return null;
}
}
return this;
}).call({});
return xmlToJSON;
}
}
/* tslint:disable */
// polyfill for Object.assign (not part of TS yet)
// https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
if (!Object.assign) {
Object.defineProperty(Object, "assign", {
enumerable: false,
configurable: true,
writable: true,
value: function (target) {
"use strict";
if (target === undefined || target === null) {
throw new TypeError("Cannot convert first argument to object");
}
var to = Object(target);
for (var i = 1; i < arguments.length; i++) {
var nextSource = arguments[i];
if (nextSource === undefined || nextSource === null) {
continue;
}
nextSource = Object(nextSource);
var keysArray = Object.keys(nextSource);
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
var nextKey = keysArray[nextIndex];
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
if (desc !== undefined && desc.enumerable) {
to[nextKey] = nextSource[nextKey];
}
}
}
return to;
}
});
}
// window['StringJS'] = ss.default;
// MyS.prototype = StringJS('')
// MyS.prototype.constructor = MyS;
// function MyS(val) {
// this.setValue(val);
// }
//
// var formatMoney = function(n, c, d, t){
// var c = isNaN(c = Math.abs(c)) ? 2 : c,
// d = d == undefined ? "." : d,
// t = t == undefined ? "," : t,
// s = n < 0 ? "-" : "",
// i:any = String(parseInt(n = Math.abs(Number(n) || 0).toFixed(c))),
// j = (j = i.length) > 3 ? j % 3 : 0;
// return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
// };
//
// MyS.prototype.isBlank = function () {
// var value = this.s;
// if (_.isNaN(value))
// return true;
// if (_.isUndefined(value))
// return true;
// if (_.isNull(value))
// return true;
// if (_.isEmpty(String(value)))
// return true;
// return false;
// }
//
// MyS.prototype.isNotBlank = function () {
// var value = this.s;
// if (_.isNaN(value))
// return false;
// if (_.isUndefined(value))
// return false;
// if (_.isNull(value))
// return false;
// if (_.isEmpty(String(value)))
// return false;
// return true;
// }
//
// /**
// * booleanToNumber
// * convert boolean to a number 0 or 1
// * if forceCast is true, it will always return a number, else it will alow strings to pass through it
// * @param forceCast
// * @returns {any}
// */
// MyS.prototype.booleanToNumber = function (forceCasting: boolean = false) {
// var value = this.s;
// if (value == '')
// return 0;
// if (_.isUndefined(value) || _.isNull(value) || value == 'NaN' || value == 'null' || value == 'NULL')
// return 0;
// if (value === "0" || value === 'false' || value === "False" || value === false)
// return 0;
// if (value === 1 || value === "true" || value === "True" || value === true)
// return 1;
// if (forceCasting) {
// return parseInt(value);
// } else {
// return value;
// }
// }
//
// MyS.prototype.toCurrency = function (format?: 'us'|'eu') {
//
// var value = StringJS(this.s).toFloat(2);
// if (_.isNaN(value))
// value = 0;
// switch (format) {
// case 'eu': {
// return '€' + formatMoney(value, 2, '.', ',');
// }
// case 'us': {}
// default: {
// return '$' + formatMoney(value, 2, '.', ',');
// }
// }
// }
//
// MyS.prototype.toPercent = function () {
// return StringJS(this.s).toFloat(2) + '%';
// }
//
// MyS.prototype.fileTailName = function (i_level) {
// var fileName = this.s;
// var arr = fileName.split('/');
// var size = arr.length;
// var c = arr.slice(0 - i_level, size)
// return new this.constructor(c.join('/'));
// }
//
// MyS.prototype.cleanChar = function () {
// var value = this.s;
// if (_.isUndefined(value))
// return '';
// if (_.isNull(value))
// return '';
// if (_.isNumber(value))
// return value;
// if (_.isBoolean(value))
// return value;
// value = value.replace(/\}/g, ' ');
// value = value.replace(/%/g, ' ');
// value = value.replace(/{/g, ' ');
// value = value.replace(/"/g, '`');
// value = value.replace(/'/g, '`');
// value = value.replace(/&/g, 'and');
// value = value.replace(/>/g, ' ');
// value = value.replace(/
Have a nice day :)
loading...
have a nice day
Upgrade to Enterprise
Pick your language
================================================
FILE: src/app/app-component.ts
================================================
import {AfterViewInit, Component, VERSION, ViewChild, ViewContainerRef} from "@angular/core";
import "rxjs/add/operator/catch";
import {ActivatedRoute, NavigationEnd, Router} from "@angular/router";
import {CommBroker} from "../services/CommBroker";
import {EventManager, Title} from "@angular/platform-browser";
import {ToastsManager} from "ng2-toastr";
import {Observable} from "rxjs";
import * as packageJson from "../../package.json";
import {AuthService} from "../services/AuthService";
import {LocalStorage} from "../services/LocalStorage";
import {YellowPepperService} from "../services/yellowpepper.service";
import {RedPepperService} from "../services/redpepper.service";
import {IUiState} from "../store/store.data";
import {ACTION_LIVELOG_UPDATE, ACTION_UISTATE_UPDATE} from "../store/actions/appdb.actions";
import {ModalComponent} from "ng2-bs3-modal/ng2-bs3-modal";
import {Map, List} from 'immutable';
import {Consts} from "../interfaces/Consts";
import {animate, state, style, transition, trigger} from "@angular/animations";
import * as moment from 'moment'
import {LiveLogModel} from "../models/live-log-model";
import {LocaleSelector} from "./locale-selector/local-selector";
enum MainAppShowModeEnum {
MAIN,
SAVE,
PREVIEW,
LOGOUT
}
export enum MainAppShowStateEnum {
INIT,
NORMAL,
SAVE,
SAVING,
SAVE_AND_PREVIEW,
SAVED,
GOODBYE
}
@Component({
selector: 'app-root',
templateUrl: './app-component.html',
animations: [
trigger('logoutState', [
state('active', style({
transform: 'scale(2)',
alpha: 0
})),
transition('* => active', animate('1000ms ease-out'))
])
]
})
export class AppComponent implements AfterViewInit {
version: string;
ngVersion: string;
offlineDevMode: any = window['offlineDevMode'];
m_ShowModeEnum = MainAppShowModeEnum;
m_showMode: any = MainAppShowModeEnum.MAIN;
m_hidden = false;
m_localSelected;
// isBrandingDisabled: Observable;
syncOnSave = false;
m_logoutState = '';
productName = 'Studio-Lite';
isBrandingDisabled: boolean = false;
demoModeMsg = `Sorry cannot save while in demo mode, please open a new FREE account to be able to use all features...`;
constructor(private router: Router,
private localStorage: LocalStorage,
private commBroker: CommBroker,
private rp: RedPepperService,
private authService: AuthService,
private yp: YellowPepperService,
private activatedRoute: ActivatedRoute,
private vRef: ViewContainerRef,
private titleService: Title,
private eventManager: EventManager,
private toastr: ToastsManager) {
// this.version = packageJson.version;
// this.ngVersion = VERSION.full
// this.localStorage.removeItem('remember_me')
// this.localStorage.removeItem('business_id')
// this.localStorage.removeItem('no_show_limited')
this.checkPlatform();
this.listenAppStateChange();
this.toastr.setRootViewContainerRef(vRef);
this.listenRouterUpdateTitle();
this.listenUpgradeEnterpris();
this.listenSaves();
this.appResized();
Observable.fromEvent(window, 'resize').debounceTime(250)
.subscribe(() => {
this.appResized();
}, (e) => {
console.error(e)
});
}
@ViewChild('modalProUpgrade')
modal: ModalComponent;
@ViewChild('modalLocale')
modalLocale: ModalComponent;
@ViewChild('localSelector')
localSelector: LocaleSelector;
ngOnInit() {
this.yp.isBrandingDisabled()
.subscribe((v) => {
this.isBrandingDisabled = v;
if (!this.isBrandingDisabled)
this.productName = this.rp.getUserData().resellerName;
}, (e) => console.error(e));
let s = this.router.events
.subscribe((val) => {
if (val instanceof NavigationEnd) {
if (val.url.indexOf('data') > -1 || val.url.indexOf('remoteStatus') > -1) {
this.router.navigate(['/FasterqTerminal', val.url.split('?')[1]]);
} else {
this.authService.start();
}
s.unsubscribe();
}
}, (e) => console.error(e));
}
_onMenuIcon(icon, event) {
event.stopImmediatePropagation();
event.preventDefault();
switch (icon) {
case 'web': {
window.open('http://www.digitalsignage.com', '_blank');
break;
}
case 'chat': {
window.open('http://www.digitalsignage.com/_html/live_chat.html', '_blank');
break;
}
case 'upgrade': {
this.modal.open();
break;
}
case 'save': {
this.saveAndRestartPrompt(() => {
})
break;
}
case 'locale': {
this.modalLocale.open();
break;
}
}
}
/**
Save and serialize configuration to remote mediaSERVER> Save and restart will check if
the Stations module has been loaded and if no connected stations are present, it will NOT
prompt for option to restart station on save, otherwise it will.
@method saveAndRestartPrompt
@param {Function} call back after save
**/
saveAndRestartPrompt(i_callBack) {
bootbox.dialog({
message: 'Restart connected stations and apply your saved work?',
title: 'Save work to remote server',
buttons: {
success: {
label: 'OK',
className: "btn-success",
callback: () => {
let uiState: IUiState = {mainAppState: MainAppShowStateEnum.SAVE}
this.yp.ngrxStore.dispatch(({type: ACTION_UISTATE_UPDATE, payload: uiState}))
this.yp.dispatch(({type: ACTION_LIVELOG_UPDATE, payload: new LiveLogModel({event: 'app saved'})}));
}
},
danger: {
label: 'Save & restart stations',
className: "btn-success",
callback: () => {
// reboot will reboot the PC or exits presentation android
// pepper.sendCommand('rebootStation', -1, function () {});
// reboot player exits player
// pepper.sendCommand('rebootPlayer', -1, function () {
// sync and restart does a fast / soft restart of player
this.syncOnSave = true;
let uiState: IUiState = {mainAppState: MainAppShowStateEnum.SAVE}
this.yp.ngrxStore.dispatch(({type: ACTION_UISTATE_UPDATE, payload: uiState}))
this.yp.dispatch(({type: ACTION_LIVELOG_UPDATE, payload: new LiveLogModel({event: 'app saved and restarting all stations'})}));
}
},
main: {
label: 'Cancel',
callback: () => {
return;
}
}
}
});
}
ngAfterViewInit() {
let uiState: IUiState = {mainAppState: MainAppShowStateEnum.NORMAL}
this.yp.ngrxStore.dispatch(({type: ACTION_UISTATE_UPDATE, payload: uiState}))
}
_onLocaleChanged(i_localSelected) {
this.m_localSelected = i_localSelected;
this.yp.ngrxStore.dispatch(({type: ACTION_UISTATE_UPDATE, payload: {mainAppState: MainAppShowStateEnum.SAVE}}));
this.modalLocale.close();
}
private listenAppStateChange() {
this.yp.listenMainAppState()
.subscribe((i_value: MainAppShowStateEnum) => {
switch (i_value) {
case MainAppShowStateEnum.SAVE_AND_PREVIEW: {
if (this.rp.getUserData().businessID == 459848) {
this.viewMode(MainAppShowModeEnum.MAIN);
const uiState: IUiState = {mainAppState: MainAppShowStateEnum.NORMAL};
this.yp.ngrxStore.dispatch(({type: ACTION_UISTATE_UPDATE, payload: uiState}));
return bootbox.alert(this.demoModeMsg);
}
this.save(() => {
this.yp.dispatch(({type: ACTION_LIVELOG_UPDATE, payload: new LiveLogModel({event: 'loading preview'})}));
this.viewMode(MainAppShowModeEnum.PREVIEW);
});
break;
}
case MainAppShowStateEnum.NORMAL: {
this.viewMode(MainAppShowModeEnum.MAIN);
break;
}
case MainAppShowStateEnum.SAVED: {
con('Saved to server');
if (this.syncOnSave)
this.rp.sendCommand('syncAndStart', -1, () => {
});
this.syncOnSave = false;
const uiState: IUiState = {appSaved: moment().format('h:mm:ss')};
this.yp.ngrxStore.dispatch(({type: ACTION_UISTATE_UPDATE, payload: uiState}));
if (this.m_localSelected)
this.localSelector.redirect(this.m_localSelected)
break;
}
case MainAppShowStateEnum.GOODBYE: {
con('Goodbye');
this.m_logoutState = 'active'
this.viewMode(MainAppShowModeEnum.LOGOUT);
break;
}
case MainAppShowStateEnum.SAVE: {
if (this.rp.getUserData().businessID == 459848) {
this.viewMode(MainAppShowModeEnum.MAIN);
const uiState: IUiState = {mainAppState: MainAppShowStateEnum.NORMAL};
this.yp.ngrxStore.dispatch(({type: ACTION_UISTATE_UPDATE, payload: uiState}));
return bootbox.alert(this.demoModeMsg);
}
this.save(() => {
this.viewMode(MainAppShowModeEnum.MAIN);
const uiState: IUiState = {mainAppState: MainAppShowStateEnum.NORMAL};
this.yp.ngrxStore.dispatch(({type: ACTION_UISTATE_UPDATE, payload: uiState}));
});
break;
}
}
}, (e) => console.error(e))
}
private save(i_cb: () => void) {
this.viewMode(MainAppShowModeEnum.SAVE);
let uiState: IUiState = {mainAppState: MainAppShowStateEnum.SAVING}
this.yp.ngrxStore.dispatch(({type: ACTION_UISTATE_UPDATE, payload: uiState}))
this.rp.save((result) => {
if (result.status == true) {
this.rp.reduxCommit(null, true)
let uiState: IUiState = {mainAppState: MainAppShowStateEnum.SAVED}
this.yp.ngrxStore.dispatch(({type: ACTION_UISTATE_UPDATE, payload: uiState}))
i_cb();
} else {
alert('error ' + JSON.stringify(result));
}
})
}
private viewMode(i_mode: MainAppShowModeEnum) {
this.m_showMode = i_mode;
switch (i_mode) {
case MainAppShowModeEnum.MAIN: {
this.m_hidden = false;
break;
}
case MainAppShowModeEnum.PREVIEW: {
this.m_hidden = true;
break;
}
case MainAppShowModeEnum.SAVE: {
this.m_hidden = true;
break;
}
case MainAppShowModeEnum.LOGOUT: {
this.m_hidden = true;
break;
}
}
}
private checkPlatform() {
switch (platform.name.toLowerCase()) {
case 'microsoft edge': {
// alert(`${platform.name} browser not supported at this time, please use Google Chrome`);
break;
}
case 'chrome': {
break;
}
default: {
// alert('for best performance please use Google Chrome');
break;
}
}
}
private listenUpgradeEnterpris() {
this.commBroker.onEvent(Consts.Events().UPGRADE_ENTERPRISE)
.subscribe((v) => {
this.modal.open();
}, (e) => console.error(e));
}
private listenSaves() {
this.eventManager.addGlobalEventListener('window', 'keydown.control.s', (event) => {
event.preventDefault();
this.yp.ngrxStore.dispatch(({type: ACTION_UISTATE_UPDATE, payload: {mainAppState: MainAppShowStateEnum.SAVE}}));
})
}
public appResized(): void {
var appHeight = document.body.clientHeight;
var appWidth = document.body.clientWidth;
var uiState: IUiState = {appSized: Map({width: appWidth, height: appHeight})}
this.yp.dispatch(({type: ACTION_UISTATE_UPDATE, payload: uiState}))
this.commBroker.setValue(Consts.Values().APP_SIZE, {
height: appHeight,
width: appWidth
});
this.commBroker.fire({
fromInstance: self,
event: Consts.Events().WIN_SIZED,
context: '',
message: {
height: appHeight,
width: appWidth
}
})
}
private listenRouterUpdateTitle() {
this.router.events
.filter(event => event instanceof NavigationEnd)
.map(() => this.activatedRoute)
.map(route => {
while (route.firstChild) {
route = route.firstChild
}
return route;
}).filter(route => route.outlet === 'primary')
.mergeMap(route => route.data)
.subscribe((event) => {
this.titleService.setTitle(event['title'])
}, (e) => console.error(e));
}
}
================================================
FILE: src/app/app-module.ts
================================================
import {BrowserModule} from "@angular/platform-browser";
import {Compiler, NgModule, ErrorHandler} from "@angular/core";
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import {HttpModule, JsonpModule} from "@angular/http";
import {Ng2Bs3ModalModule} from "ng2-bs3-modal/ng2-bs3-modal";
import {AppComponent} from "./app-component";
import {LocalStorage} from "../services/LocalStorage";
import {RedPepperService} from "../services/redpepper.service";
import {YellowPepperService} from "../services/yellowpepper.service";
import {MsLibModule} from "ng-mslib/dist/mslib.module";
import {ToastModule, ToastOptions} from "ng2-toastr";
import {AccordionModule, AlertModule, ModalModule} from "ngx-bootstrap";
import {DropdownModule, DropdownModule as DropdownModulePrime, InputTextModule, SelectButtonModule, TreeModule} from "primeng/primeng";
import {routing} from "../app-routes";
import {LoginPanel} from "../comps/entry/LoginPanel";
import {Logout} from "../comps/logout/Logout";
import {AgmCoreModule} from "angular2-google-maps/core";
import {ImgLoader} from "../comps/imgloader/ImgLoader";
import {ChartModule} from "angular2-highcharts";
import {CommBroker} from "../services/CommBroker";
import {AUTH_PROVIDERS} from "../services/AuthService";
import {StoreService} from "../services/StoreService";
import {NgMenu} from "../comps/ng-menu/ng-menu";
import {NgMenuItem} from "../comps/ng-menu/ng-menu-item";
import {AutoLogin} from "../comps/entry/AutoLogin";
import {StoreModule} from "@ngrx/store";
import {INITIAL_APPLICATION_STATE} from "../store/application.state";
import {EffectsModule} from "@ngrx/effects";
import {StoreDevtoolsModule} from "@ngrx/store-devtools";
import {ACTION_LIVELOG_UPDATE, AppdbAction} from "../store/actions/appdb.actions";
import {AppDbEffects} from "../store/effects/appdb.effects";
import {MsdbEffects} from "../store/effects/msdb.effects";
import {environment} from "../environments/environment";
import {productionReducer} from "../store/store.data";
import {NgmslibService} from "ng-mslib";
import {SharedModule} from "../modules/shared.module";
import {Dashboard} from "./dashboard/dashboard-navigation";
import {Appwrap} from "./appwrap";
import "hammerjs";
import "print-js";
import "gsap";
import "gsap/CSSPlugin";
import "gsap/Draggable";
import "gsap/TweenLite";
import "gsap/ScrollToPlugin";
import {Lib} from "../Lib";
import {FontLoaderService} from "../services/font-loader-service";
import {SimpleGridModule} from "../comps/simple-grid-module/SimpleGridModule";
import {GlobalErrorHandler} from "../services/global-error-handler";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {FasterqTerminal} from "./fasterq/fasterq-terminal";
import {WizardService} from "../services/wizard-service";
import {ResellerLogo} from "../comps/logo/reseller-logo";
import {DashPanel} from "./dashboard/dash-panel";
import {ServerAvg} from "./dashboard/server-avg";
import {StorageUsed} from "./dashboard/storage-used";
import {LiveLogModel} from "../models/live-log-model";
// import "fabric"; // need to remove if we import via cli
// import {ScreenTemplate} from "../comps/screen-template/screen-template";
declare global {
interface JQueryStatic {
base64: any;
knob: any;
gradientPicker: any;
timepicker: any;
contextmenu: any;
index: any;
}
}
export class CustomToastOption extends ToastOptions {
animate: 'flyRight';
positionClass: 'toast-bottom-right';
toastLife: 10000;
showCloseButton: true;
maxShown: 5;
newestOnTop: true;
enableHTML: true;
dismiss: 'auto';
messageClass: "";
titleClass: ""
}
export const providing = [CommBroker, WizardService, AUTH_PROVIDERS, RedPepperService, YellowPepperService, LocalStorage, StoreService, FontLoaderService, AppdbAction, {
provide: "OFFLINE_ENV",
useValue: window['offlineDevMode']
},
{
provide: "HYBRID_PRIVATE",
useValue: false
},
{
provide: ErrorHandler,
useClass: GlobalErrorHandler
},
{
provide: ToastOptions,
useClass: CustomToastOption
}
];
const decelerations = [AppComponent, AutoLogin, LoginPanel, Appwrap, Dashboard, Logout, NgMenu, NgMenuItem, ImgLoader, FasterqTerminal, DashPanel, ServerAvg, StorageUsed];
export function appReducer(state: any = INITIAL_APPLICATION_STATE, action: any) {
if (environment.production) {
return productionReducer(state, action);
} else {
return productionReducer(state, action);
// return developmentReducer(state, action);
}
}
@NgModule({
declarations: [decelerations],
imports: [
BrowserModule,
FormsModule,
BrowserAnimationsModule,
ReactiveFormsModule,
Ng2Bs3ModalModule,
HttpModule,
ChartModule,
StoreModule.provideStore(appReducer),
EffectsModule.run(AppDbEffects),
EffectsModule.run(MsdbEffects),
environment.imports,
// StoreDevtoolsModule.instrumentStore({maxAge: 2}),
// StoreDevtoolsModule.instrumentOnlyWithExtension(),
AgmCoreModule.forRoot({
apiKey: 'AIzaSyDKa8Z3QLtACfSfxF-S8A44gm5bkvNTmuM',
libraries: ['places']
}),
SimpleGridModule.forRoot(),
SharedModule.forRoot(),
ToastModule.forRoot(),
AlertModule.forRoot(),
MsLibModule.forRoot({a: 1}),
ModalModule.forRoot(),
DropdownModule,
AccordionModule.forRoot(),
JsonpModule,
TreeModule,
InputTextModule,
SelectButtonModule,
InputTextModule,
DropdownModulePrime,
routing,
],
providers: [providing],
bootstrap: [AppComponent]
})
export class AppModule {
constructor(private commBroker: CommBroker, private compiler: Compiler, private ngmslibService: NgmslibService, private yp: YellowPepperService, private fontLoaderService: FontLoaderService) {
Lib.Con(`running in dev mode: ${Lib.DevMode()}`);
Lib.Con(`App in ${(compiler instanceof Compiler) ? 'AOT' : 'JIT'} mode`);
window['business_id'] = -1;
window['jQueryAny'] = jQuery;
window['jXML'] = jQuery;
this.ngmslibService.globalizeStringJS();
Lib.Con(StringJS('app-loaded-and-ready').humanize().s);
Lib.AlertOnLeave();
this.yp.dispatch(({type: ACTION_LIVELOG_UPDATE, payload: new LiveLogModel({event: 'app started'})}));
}
}
================================================
FILE: src/app/appwrap.ts
================================================
import {Component} from "@angular/core";
import {Router} from "@angular/router";
import {Compbaser} from "ng-mslib";
import {Observable} from "rxjs/Observable";
import {YellowPepperService} from "../services/yellowpepper.service";
@Component({
template: `
`
})
export class Appwrap extends Compbaser {
isBrandingDisabled: Observable
constructor(private router: Router, private yp:YellowPepperService) {
super();
jQuery(".navbar-header .navbar-toggle").trigger("click");
jQuery('.navbar-nav').css({
display: 'block'
});
this.isBrandingDisabled = this.yp.isBrandingDisabled()
}
// public listenMenuChanges() {
// var unsub = self.commBroker.onEvent(Consts.Events().MENU_SELECTION).subscribe((e: IMessage) => {
// if (!this.routerActive)
// return;
// let screen = (e.message);
// self.router.navigate([`/App1/${screen}`]);
// });
// }
}
================================================
FILE: src/app/blocks/block-fabric-image.ts
================================================
import {BlockFabric} from "./block-fabric";
import * as _ from "lodash";
import {BlockLabels} from "../../interfaces/Consts";
const blockType = BlockLabels.BLOCKCODE_IMAGE;
export class BlockFabricImage extends BlockFabric {
m_canvas;
m_gridMagneticMode = 0;
m_nativeID;
m_fileFormat;
constructor(options, i_blockService, i_pepper) {
super(options, i_blockService, i_pepper, blockType)
this.m_blockService = i_blockService;
this.m_pepper = i_pepper;
this.m_blockType = blockType;
_.extend(options, {blockType: this.m_blockType})
this._initResourcesData();
}
/**
Set the instance resource data from msdb which includes resource_id (handle of a resource)
as well as the description of the resource and icon.
@method _initResourcesData
**/
_initResourcesData() {
var domPlayerData = this._getBlockPlayerData();
var xSnippet = $(domPlayerData).find('Resource');
this.m_resourceID = $(xSnippet).attr('hResource');
this.m_nativeID = this.m_pepper.getResourceNativeID(this.m_resourceID);
if (_.isNull(this.m_nativeID)) {
this._selfDestruct();
return;
}
this.m_blockName = this.m_pepper.getResourceRecord(this.m_resourceID).resource_name;
this.m_blockDescription = this.m_pepper.getResourceName(this.m_resourceID);
this.m_fileFormat = this.m_pepper.getResourceType(this.m_resourceID);
this.m_blockFontAwesome = this.m_blockService.getFontAwesome(this.m_fileFormat);
}
/**
Convert the block into a fabric js compatible object
@Override
@method fabricateBlock
**/
fabricateBlock(i_canvasScale, i_callback) {
var domPlayerData = this._getBlockPlayerData();
var layout = $(domPlayerData).find('Layout');
var businessID = this.m_pepper.getUserData().businessID;
var elemID = _.uniqueId('imgElemrand')
var imgPath;
if (this.m_fileFormat == 'swf') {
imgPath = './_assets/flash.png';
} else {
/*
if (platform.name == 'Chrome') {
// CDN
imgPath = window.g_protocol + 's3.signage.me/business' + this.m_pepper.getUserData().businessID + '/resources/';
imgPath = 'https://s3.signage.me/business' + this.m_pepper.getUserData().businessID + '/resources/';
imgPath += +this.m_nativeID + '.' + this.m_fileFormat;
} else {
// Legacy
imgPath = window.g_protocol + this.m_pepper.getUserData().domain + '/Resources/business' + this.m_pepper.getUserData().businessID + '/resources/' + this.m_nativeID + '.' + this.m_fileFormat;
}
*/
imgPath = window.g_protocol + this.m_pepper.getUserData().domain + '/Resources/business' + this.m_pepper.getUserData().businessID + '/resources/' + this.m_nativeID + '.' + this.m_fileFormat;
// log('loading img from ' + imgPath);
}
var initImage = (i_image, i_passed) => {
if (!i_passed) {
i_callback();
return;
}
$(i_image).width(1000).height(800).appendTo('body');
var options = this._fabricateOptions(parseInt(layout.attr('y')), parseInt(layout.attr('x')), parseInt(layout.attr('width')), parseInt(layout.attr('height')), parseInt(layout.attr('rotation')));
var img = new fabric.Image(i_image, options);
_.extend(this, img);
this._fabricAlpha(domPlayerData);
this._fabricLock();
this['canvasScale'] = i_canvasScale;
i_callback();
};
// manage errors of resources which don't load
$(``).on('load', function() {
initImage(this, true);
}).on('error', function() {
initImage(this, false);
})
}
/**
Get the resource id of the embedded resource
**/
getResourceID() {
return this.m_resourceID;
}
/**
Delete this block
@method deleteBlock
@params {Boolean} i_memoryOnly if true only remove from existance but not from msdb
**/
deleteBlock(i_memoryOnly) {
// $(Elements.IMAGE_ASPECT_RATIO).off('change', this.m_inputChangeHandler);
this._deleteBlock(i_memoryOnly);
}
}
================================================
FILE: src/app/blocks/block-fabric-josn-item.ts
================================================
import {BlockFabric} from "./block-fabric";
import * as _ from "lodash";
import {Lib} from "../../Lib";
import {BlockLabels} from "../../interfaces/Consts";
import {BlockFabricLabel} from "./block-fabric-label";
const blockType = BlockLabels.BLOCKCODE_JSON_ITEM;
export class BlockFabricJsonItem extends BlockFabricLabel {
protected m_options;
protected m_selected;
protected m_labelFontSelector:any;
protected m_config:{};
protected m_sceneMime:string;
constructor(options, i_blockService, i_pepper) {
super(options, i_blockService, i_pepper)
this.m_blockService = i_blockService;
this.m_pepper = i_pepper;
this.m_blockType = blockType;
_.extend(options, {blockType: this.m_blockType})
this.m_sceneMime = this.m_pepper.getSceneMime(this.m_sceneID);
this.m_config = {
'Json.instagram.feed': {
title: 'Instagram',
tabTitle: 'Posts',
fields: {
1: {
name: "title",
type: "text",
label: "title"
},
2: {
name: "urlImage",
type: "resource",
label: "image"
},
3: {
name: "video",
type: "resource",
label: "video"
}
}
},
'Json.twitter': {
title: 'Twitter',
tabTitle: 'Tweets',
fields: {
1: {
name: "name",
type: "text",
label: "name"
},
2: {
name: "text",
type: "text",
label: "text"
},
3: {
name: "screen_name",
type: "text",
label: "screen name"
},
4: {
name: "created_at",
type: "text",
label: "created at"
},
5: {
name: "profile_background_image_url",
type: "resource",
label: "Background image"
},
6: {
name: "profile_image_url",
type: "resource",
label: "Image"
}
}
},
'Json.digg': {
title: 'Digg',
tabTitle: 'Posts',
fields: {
1: {
name: "title",
type: "text",
label: "title"
},
2: {
name: "link",
type: "resource",
label: "image"
}
}
},
'Json.spreadsheet': {
title: 'Spreadsheet',
tabTitle: 'Cells',
fields: {
1: {
name: "$cells.1.1.value",
type: "dual_numeric",
label: "Sheet cell"
}
}
},
'Json.calendar': {
title: 'Calendar',
tabTitle: 'Date',
fields: {
1: {
name: "summary",
type: "text",
label: "summary"
},
2: {
name: "description",
type: "text",
label: "description"
},
3: {
name: "organizer",
type: "text",
label: "organizer"
},
4: {
name: "organizerEmail",
type: "text",
label: "organizer email"
},
5: {
name: "created",
type: "text",
label: "created"
},
6: {
name: "startDateTime_time",
type: "date",
label: "start date time"
},
7: {
name: "endDateTime_time",
type: "date",
label: "end date time"
},
8: {
name: "updated",
type: "text",
label: "updated"
}
}
},
'Json.weather': {
title: 'World weather',
tabTitle: 'Conditions',
fields: {
1: {
name: "$[0].data.current_condition[0].iconPath",
type: "resource",
label: "current icon"
},
2: {
name: "$[0].data.current_condition[0].temp_@",
type: "text",
label: "current temp"
},
3: {
name: "$[0].data.current_condition[0].humidity",
type: "text",
label: "current humidity"
},
4: {
name: "$[0].data.weather[0].iconPath",
type: "resource",
label: "today icon"
},
5: {
name: "$[0].data.weather[0].mintemp@",
type: "text",
label: "today min temp"
},
6: {
name: "$[0].data.weather[0].maxtemp@",
type: "text",
label: "today max temp"
},
7: {
name: "$[0].data.weather[0].day",
type: "text",
label: "today label"
},
8: {
name: "$[0].data.weather[1].iconPath",
type: "resource",
label: "today+1 icon"
},
9: {
name: "$[0].data.weather[1].mintemp@",
type: "text",
label: "today+1 min temp"
},
10: {
name: "$[0].data.weather[1].maxtemp@",
type: "text",
label: "today+1 max temp"
},
11: {
name: "$[0].data.weather[1].day",
type: "text",
label: "today+1 label"
},
12: {
name: "$[0].data.weather[2].iconPath",
type: "resource",
label: "today+2 icon"
},
13: {
name: "$[0].data.weather[2].mintemp@",
type: "text",
label: "today+2 min temp"
},
14: {
name: "$[0].data.weather[2].maxtemp@",
type: "text",
label: "today+2 max temp"
},
15: {
name: "$[0].data.weather[2].day",
type: "text",
label: "today+2 label"
},
16: {
name: "$[0].data.weather[3].iconPath",
type: "resource",
label: "today+3 icon"
},
17: {
name: "$[0].data.weather[3].mintemp@",
type: "text",
label: "today+3 min temp"
},
18: {
name: "$[0].data.weather[3].maxtemp@",
type: "text",
label: "today+3 max temp"
},
19: {
name: "$[0].data.weather[3].day",
type: "text",
label: "today+3 label"
},
20: {
name: "$[0].data.weather[4].iconPath",
type: "resource",
label: "today+4 icon"
},
21: {
name: "$[0].data.weather[4].mintemp@",
type: "text",
label: "today+4 min temp"
},
22: {
name: "$[0].data.weather[4].maxtemp@",
type: "text",
label: "today+4 max temp"
},
23: {
name: "$[0].data.weather[4].day",
type: "text",
label: "today+4 label"
},
24: {
name: "$[0].data.weather[5].iconPath",
type: "resource",
label: "today+5 icon"
},
25: {
name: "$[0].data.weather[5].mintemp@",
type: "text",
label: "today+5 min temp"
},
26: {
name: "$[0].data.weather[5].maxtemp@",
type: "text",
label: "today+5 max temp"
},
27: {
name: "$[0].data.weather[5].day",
type: "text",
label: "today+5 label"
},
28: {
name: "$[0].data.weather[6].iconPath",
type: "resource",
label: "today+6 icon"
},
29: {
name: "$[0].data.weather[6].mintemp@",
type: "text",
label: "today+6 min temp"
},
30: {
name: "$[0].data.weather[6].maxtemp@",
type: "text",
label: "today+6 max temp"
},
31: {
name: "$[0].data.weather[6].day",
type: "text",
label: "today+6 label"
}
}
}
};
}
/**
translate a json item path such as $[0].data.weather... to it's label
@method _translateToLabel
@param {Number} i_playerData
@return {Number} Unique clientId.
**/
private _translateToLabel(i_jsonPath:string):string {
var self = this;
// no mime configured in scnene so return same label
if (_.isUndefined(self.m_sceneMime))
return i_jsonPath;
switch (self.m_sceneMime) {
case 'Json.spreadsheet':
{
// lookup up label in m_config for spreadsheet
return self.m_config['Json.spreadsheet'].fields['1'].label;
}
default:
{
// look up label in m_config db for everything else
var fields:any = self.m_config[self.m_sceneMime].fields;
for (var item in fields) {
if (fields[item].name == i_jsonPath)
return fields[item].label;
}
}
}
return i_jsonPath;
}
/**
Some json item field names need to be muated into something else.
For example, the default fieldName of text needs to be changed into '$cells.1.1.value' when
used in a scene of mimeType
@method _mutateCustomFieldName
**/
private _mutateCustomFieldName():void {
var self = this;
switch (self.m_sceneMime) {
case 'Json.spreadsheet':
{
var domPlayerData = self._getBlockPlayerData();
var xSnippet = $(domPlayerData).find('XmlItem');
var fieldName = $(xSnippet).attr('fieldName');
if (fieldName == 'text') {
var value = self.m_config['Json.spreadsheet'].fields['1'].name;
$(xSnippet).attr('fieldName', value);
// self._setBlockPlayerData(domPlayerData, BB.CONSTS.NO_NOTIFICATION);
}
break;
}
default:
{
}
}
}
/**
Convert the block into a fabric js compatible object
@Override
@method fabricateBlock
@param {number} i_canvasScale
@param {function} i_callback
**/
fabricateBlock(i_canvasScale, i_callback) {
var self= this;
self._mutateCustomFieldName();
var domPlayerData = self._getBlockPlayerData();
var layout = $(domPlayerData).find('Layout');
var xSnippet = $(domPlayerData).find('XmlItem');
var fieldName = $(xSnippet).attr('fieldName');
var text = self._translateToLabel(fieldName);
var font = $(xSnippet).find('Font');
var link = '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
var url = ('https:' === document.location.protocol ? 'https' : 'http') + link;
//$.getScript(src, function (data) {
// console.log(data);
//});
var t = new fabric.IText(text, {
fontSize: Number($(font).attr('fontSize')),
//fontFamily: 'Graduate',
//fontFamily: 'Jolly Lodger',
//fontFamily: 'Arial',
fontFamily: $(font).attr('fontFamily'),
fill: '#' + Lib.DecimalToHex($(font).attr('fontColor')),
textDecoration: $(font).attr('textDecoration'),
fontWeight: $(font).attr('fontWeight'),
fontStyle: $(font).attr('fontStyle'),
textAlign: $(font).attr('textAlign'),
top: 5,
left: 5
});
// calculate block so it can always contain the text it holds and doesn't bleed
//self.m_minSize.w = t.width < 50 ? 50 : t.width * 1.2;
//self.m_minSize.h = t.height < 50 ? 50 : t.height * 1.2;
//var w = parseInt(layout.attr('width')) < self.m_minSize.w ? self.m_minSize.w : parseInt(layout.attr('width'));
//var h = parseInt(layout.attr('height')) < self.m_minSize.h ? self.m_minSize.h : parseInt(layout.attr('height'));
var w = parseInt(layout.attr('width'));
var textWidth = t.width * 1.2;
if (textWidth > w) {
t.setText('...');
}
var h = parseInt(layout.attr('height'));
var textHeight = t.height * 1.2;
if (textHeight > h) {
t.setText('...');
}
var rec = self._fabricRect(w, h, domPlayerData);
var o = self._fabricateOptions(parseInt(layout.attr('y')), parseInt(layout.attr('x')), w, h, parseInt(layout.attr('rotation')));
rec.originX = 'center';
rec.originY = 'center';
t.top = 0 - (rec.height / 2);
t.left = 0 - (rec.width / 2);
_.extend(self, o);
self.add(rec);
self.add(t);
self._fabricAlpha(domPlayerData);
self._fabricLock();
self['canvasScale'] = i_canvasScale;
//$.ajax({
// url: url,
// async: false,
// dataType: 'script',
// complete: function (e) {
// setTimeout(i_callback, 1);
// }
//});
setTimeout(i_callback, 1);
var direction = $(font).attr('textAlign');
switch (direction) {
case 'left':
{
break;
}
case 'center':
{
t.set({
textAlign: direction,
originX: direction,
left: 0
});
break;
}
case 'right':
{
t.set({
textAlign: direction,
originX: direction,
left: rec.width / 2
});
break;
}
}
}
}
================================================
FILE: src/app/blocks/block-fabric-label.ts
================================================
import {BlockFabric} from "./block-fabric";
import * as _ from "lodash";
import {Lib} from "../../Lib";
import {BlockLabels} from "../../interfaces/Consts";
const blockType = BlockLabels.LABEL;
export class BlockFabricLabel extends BlockFabric {
constructor(options, i_blockService, i_pepper) {
super(options, i_blockService, i_pepper, blockType)
this.m_blockService = i_blockService;
this.m_pepper = i_pepper;
this.m_blockType = blockType;
_.extend(options, {blockType: this.m_blockType})
}
/**
Convert the block into a fabric js compatible object
@Override
@method fabricateBlock
@param {number} i_canvasScale
@param {function} i_callback
**/
fabricateBlock(i_canvasScale, i_callback) {
var domPlayerData = this._getBlockPlayerData();
var layout = $(domPlayerData).find('Layout');
var label = $(domPlayerData).find('Label');
var text = $(label).find('Text').text();
var font = $(label).find('Font');
var url = ('https:' === document.location.protocol ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
//$.getScript(src, function (data) {
// console.log(data);
//});
var t = new fabric.IText(text, {
fontSize: Number($(font).attr('fontSize')),
//fontFamily: 'Graduate',
//fontFamily: 'Jolly Lodger',
//fontFamily: 'Arial',
fontFamily: $(font).attr('fontFamily'),
fill: '#' + Lib.DecimalToHex($(font).attr('fontColor')),
textDecoration: $(font).attr('textDecoration'),
fontWeight: $(font).attr('fontWeight'),
fontStyle: $(font).attr('fontStyle'),
textAlign: $(font).attr('textAlign'),
top: 5,
left: 5
});
// calculate block so it can always contain the text it holds and doesn't bleed
this.m_minSize.w = t.width < 50 ? 50 : t.width * 1.2;
this.m_minSize.h = t.height < 50 ? 50 : t.height * 1.2;
var w = parseInt(layout.attr('width')) < this.m_minSize.w ? this.m_minSize.w : parseInt(layout.attr('width'));
var h = parseInt(layout.attr('height')) < this.m_minSize.h ? this.m_minSize.h : parseInt(layout.attr('height'));
var rec = this._fabricRect(w, h, domPlayerData);
var o = this._fabricateOptions(parseInt(layout.attr('y')), parseInt(layout.attr('x')), w, h, parseInt(layout.attr('rotation')));
//var group = new fabric.Group([ rec, t ], o);
//_.extend(this, group);
rec.originX = 'center';
rec.originY = 'center';
t.top = 0 - (rec.height / 2);
t.left = 0 - (rec.width / 2);
_.extend(this, o);
this.add(rec);
this.add(t);
this._fabricAlpha(domPlayerData);
this._fabricLock();
this['canvasScale'] = i_canvasScale;
//$.ajax({
// url: url,
// async: false,
// dataType: "script",
// complete: function(e){
// setTimeout(i_callback,1)
// }
//});
setTimeout(i_callback,1);
var direction = $(font).attr('textAlign');
switch (direction) {
case 'left': {
break;
}
case 'center': {
t.set({
textAlign: direction,
originX: direction,
left: 0
});
break;
}
case 'right': {
t.set({
textAlign: direction,
originX: direction,
left: rec.width / 2
});
break;
}
}
// todo: add shadow
//http://jsfiddle.net/Kienz/fgWNL/
//http://jsfiddle.net/fabricjs/7gvJG/
//http://jsfiddle.net/5KKQ2/
//t.set('shadow', {
// color: 'black',
// blur: 1,
// offsetX:3,
// offsetY: 1
//});({ color: 'rgba(12,12,12,1)' });
//rec.set('shadow', {
// color: 'black',
// blur: 1,
// offsetX:3,
// offsetY: 1
//});
}
/**
Delete this block
@method deleteBlock
@params {Boolean} i_memoryOnly if true only remove from existance but not from msdb
**/
deleteBlock(i_memoryOnly) {
// $(Elements.IMAGE_ASPECT_RATIO).off('change', this.m_inputChangeHandler);
this._deleteBlock(i_memoryOnly);
}
}
================================================
FILE: src/app/blocks/block-fabric-scene.ts
================================================
import {BlockFabric} from "./block-fabric";
import * as _ from 'lodash';
import {Lib} from "../../Lib";
import {BlockLabels} from "../../interfaces/Consts";
const blockType = BlockLabels.BLOCKCODE_SCENE;
export class BlockFabricScene extends BlockFabric {
m_canvas;
m_gridMagneticMode = 0;
constructor(options, i_blockService, i_pepper) {
super(options, i_blockService, i_pepper, blockType)
this.m_blockService = i_blockService;
this.m_pepper = i_pepper;
this.m_blockType = blockType;
_.extend(options, {blockType: this.m_blockType})
}
/**
get player data for a scene
@Override
**/
getBlockData() {
var data = BlockFabric.prototype.getBlockData.call(this);
var domPlayerData = this._getBlockPlayerData();
data.blockName = $(domPlayerData).find('Player').eq(0).attr('label');
return data;
}
/**
Update the msdb for the block with new values inside its player_data
@Override
**/
_setBlockPlayerData(i_xmlDoc, i_noNotify) {
// var player_data = (new XMLSerializer()).serializeToString(i_xmlDoc);
// switch (this.m_placement) {
// case BB.CONSTS.PLACEMENT_CHANNEL: {
// var recBlock = pepper.getCampaignTimelineChannelPlayerRecord(this.m_block_id);
// var domPlayerData = $.parseXML(recBlock['player_data']);
// var scene_id = $(domPlayerData).find('Player').attr('hDataSrc');
// var player_data = (new XMLSerializer()).serializeToString(i_xmlDoc);
// pepper.setScenePlayerData(scene_id, player_data);
// break;
// }
//
// case BB.CONSTS.PLACEMENT_IS_SCENE: {
// pepper.setScenePlayerData(this.m_block_id, player_data);
// //if (!i_noNotify)
// // this._announceBlockChanged();
// break;
// }
// }
}
/**
Get the XML player data of a block, depending where its placed
@Override
**/
_getBlockPlayerData(): any {
var blockID = this.m_pepper.getSceneIdFromPseudoId(this.m_block_id);
var recPlayerData = this.m_pepper.getScenePlayerRecord(blockID);
var xPlayerdata = recPlayerData['player_data_value'];
return $.parseXML(xPlayerdata);
// var recBlock = undefined;
//
// switch (this.m_placement) {
//
// case BB.CONSTS.PLACEMENT_CHANNEL: {
// recBlock = pepper.getCampaignTimelineChannelPlayerRecord(this.m_block_id);
// var domPlayerData = $.parseXML(recBlock['player_data']);
// var sceneHandle = $(domPlayerData).find('Player').attr('hDataSrc');
// return pepper.getScenePlayerdataDom(sceneHandle);
// break;
// }
//
// case BB.CONSTS.PLACEMENT_IS_SCENE: {
// var blockID = pepper.getSceneIdFromPseudoId(this.m_block_id);
// var recPlayerData = BB.Pepper.getScenePlayerRecord(blockID);
// var xPlayerdata = recPlayerData['player_data_value'];
// return $.parseXML(xPlayerdata);
// break;
// }
// }
}
/**
Find the border section in player_data for selected block
**/
// _findBorder(i_domPlayerData) {
// var xSnippet = $(i_domPlayerData).find('Layout').eq(0).siblings().filter('Border');
// return xSnippet;
// }
/**
Find the background section in player_data for selected block
**/
// _findBackground(i_domPlayerData) {
// var xSnippet = $(i_domPlayerData).find('Layout').eq(0).siblings().filter('Background');
// return xSnippet;
// }
/**
Find the gradient blocks in player_data for selected scene block
**/
_findGradientPoints(i_domPlayerData) {
var xBackground = $(i_domPlayerData).find('Layout').eq(0).siblings().filter('Background');
var xSnippet = $(xBackground).find('GradientPoints').eq(0);
return xSnippet;
}
/**
Add the checkers background to a scene
**/
_fabricApplySceneBgImage(i_image) {
this.m_canvas.setBackgroundColor('', this.m_canvas.renderAll.bind(this.m_canvas));
$('#sceneCanvasContainer').find('.canvas-container').removeClass('checkers').removeClass('grid25').removeClass('grid50').addClass(i_image);
this.m_canvas.renderAll();
}
/**
Set a scene's background color or image
@method fabricSceneBg
**/
fabricSceneBg() {
var domPlayerData = this._getBlockPlayerData();
var colorPoints = this._findGradientPoints(domPlayerData)
var color = $(colorPoints).find('Point').attr('color');
switch (this.m_gridMagneticMode) {
case 0: {
if (_.isUndefined(color)) {
this._fabricApplySceneBgImage('checkers');
return;
}
color = '#' + Lib.DecimalToHex(color);
if (this.m_canvas.backgroundColor == color)
return;
this.m_canvas.setBackgroundColor(color, function () {
});
this.m_canvas.renderAll();
break;
}
case 1: {
this._fabricApplySceneBgImage('grid25');
break;
}
case 2: {
this._fabricApplySceneBgImage('grid50');
break;
}
}
}
/**
Set reference to managed canvas
**/
setCanvas(i_canvas, i_magneticGridMode) {
this.m_canvas = i_canvas;
this.m_gridMagneticMode = i_magneticGridMode;
this.fabricSceneBg();
}
/**
Get the scene id that's associated with this block given that it resides in a timeline > channel
**/
// getChannelBlockSceneID() {
// var recBlock = pepper.getCampaignTimelineChannelPlayerRecord(this.m_block_id);
// var domPlayerData = $.parseXML(recBlock['player_data']);
// var scene_id = $(domPlayerData).find('Player').attr('hDataSrc');
// return scene_id;
// }
/**
Delete this block
@method deleteBlock
@params {Boolean} i_memoryOnly if true only remove from existance but not from msdb
**/
deleteBlock(i_memoryOnly) {
// BB.comBroker.stopListenWithNamespace(BB.EVENTS.SCENE_BG_COLOR_CHANGED, this);
// $(Elements.SCENE_NAME_INPUT).off("input", this.m_inputNameChangeHandler);
// $(Elements.SCENE_WIDTH_INPUT).off("input", this.m_inputWidthChangeHandler);
// $(Elements.SCENE_WIDTH_INPUT).off("blur", this.m_inputWidthChangeHandler);
// $(Elements.SCENE_HEIGHT_INPUT).off("blur", this.m_inputWidthChangeHandler);
// $(Elements.SCENE_HEIGHT_INPUT).off("input", this.m_inputHeightChangeHandler);
// this._deleteBlock(i_memoryOnly);
}
}
================================================
FILE: src/app/blocks/block-fabric-svg.ts
================================================
import {BlockFabric} from "./block-fabric";
import * as _ from "lodash";
import {BlockLabels} from "../../interfaces/Consts";
const blockType = BlockLabels.BLOCKCODE_SVG;
export class BlockFabricSvg extends BlockFabric {
m_nativeID;
m_fileFormat;
constructor(options, i_blockService, i_pepper) {
super(options, i_blockService, i_pepper, blockType)
this.m_blockService = i_blockService;
this.m_pepper = i_pepper;
this.m_blockType = blockType;
_.extend(options, {blockType: this.m_blockType})
this._initResourcesData();
}
/**
Set the instance resource data from msdb which includes resource_id (handle of a resource)
as well as the description of the resource and icon.
@method _initResourcesData
**/
_initResourcesData() {
var domPlayerData = this._getBlockPlayerData();
var xSnippet = $(domPlayerData).find('Resource');
this.m_resourceID = $(xSnippet).attr('hResource');
this.m_nativeID = this.m_pepper.getResourceNativeID(this.m_resourceID);
if (_.isNull(this.m_nativeID)) {
this._selfDestruct();
return;
}
this.m_blockName = this.m_pepper.getResourceRecord(this.m_resourceID).resource_name;
this.m_blockDescription = this.m_pepper.getResourceName(this.m_resourceID);
this.m_fileFormat = this.m_pepper.getResourceType(this.m_resourceID);
this.m_blockFontAwesome = this.m_blockService.getFontAwesome(this.m_fileFormat);
}
// /var/www/sites/dynasite/htdocs/_msportal/_js/_node/public/assets/14.svg
/**
Convert the block into a fabric js compatible object, called externally on creation of block
@Override
@method fabricateBlock
**/
fabricateBlock(i_canvasScale, i_callback) {
var self = this;
var domPlayerData = self._getBlockPlayerData();
var layout = $(domPlayerData).find('Layout');
var w = parseInt(layout.attr('width'));
var h = parseInt(layout.attr('height'));
var rec = self._fabricRect(w, h, domPlayerData);
var svgPath = window.g_protocol + self.m_pepper.getUserData().domain + '/Resources/business' + self.m_pepper.getUserData().businessID + '/resources/' + self.m_nativeID + '.' + self.m_fileFormat;
var urlPath = jQuery.base64.encode(svgPath);
var srvPath = 'https://secure.digitalsignage.com/proxyRequest/' + urlPath;
//svgPath = 'https://secure.digitalsignage.com/_public/assets/15.svg';
//svgPath = 'https://ida.signage.me/Test/14.svg';
//svgPath = 'https://ida.signage.me/code/14.svg';
//svgPath = "https://s3-us-west-2.amazonaws.com/oregon-signage-resources/business372844/resources/14.svg";
//svgPath = 'https://ida2.signage.me/14.svg';
$.get(srvPath, function (svg) {
var hh, ww, svgHeight, svgWidth, re;
// set new height in SVG per current selection box height
hh = layout.attr('height');
// catch load errors
svgHeight = svg.match(/(height=")([^\"]*)/)
if (_.isNull(svgHeight)) {
i_callback();
return;
}
svgHeight = svgHeight[2];
re = new RegExp('height="' + svgHeight + '"', "ig");
svg = svg.replace(re, 'height="' + hh + '"');
// set new width in SVG per current selection box width
ww = layout.attr('width');
svgWidth = svg.match(/(width=")([^\"]*)/)[2];
re = new RegExp('width="' + svgWidth + '"', "ig");
svg = svg.replace(re, 'width="' + ww + '"');
fabric.loadSVGFromString(svg, function (objects:any, options) {
objects[0].heightAttr = hh;
objects[0].widthAttr = ww;
objects[0].height = hh;
objects[0].width = ww;
var groupSvg = fabric.util.groupSVGElements(objects, options);
rec.originX = 'center';
rec.originY = 'center';
groupSvg.originX = 'center';
groupSvg.originY = 'center';
var o = {
left: parseInt(layout.attr('x')),
top: parseInt(layout.attr('y')),
width: parseInt(layout.attr('width')),
height: parseInt(layout.attr('height')),
angle: parseInt(layout.attr('rotation')),
hasRotatingPoint: false,
stroke: 'transparent',
cornerColor: 'black',
cornerSize: 5,
lockRotation: true,
transparentCorners: false
};
_.extend(self, o);
self.add(rec);
self.add(groupSvg);
self._fabricAlpha(domPlayerData);
self._fabricLock();
self['canvasScale'] = i_canvasScale;
i_callback();
});
}, 'text');
}
/**
Get the resource id of the embedded resource
@method getResourceID
@return {Number} resource_id;
**/
getResourceID() {
return this.m_resourceID;
}
/**
Delete this block
@method deleteBlock
@params {Boolean} i_memoryOnly if true only remove from existance but not from msdb
**/
deleteBlock(i_memoryOnly) {
// $(Elements.IMAGE_ASPECT_RATIO).off('change', this.m_inputChangeHandler);
this._deleteBlock(i_memoryOnly);
}
}
================================================
FILE: src/app/blocks/block-fabric.ts
================================================
import * as _ from 'lodash';
import {Lib} from "../../Lib";
import {BlockService} from "./block-service";
import {RedPepperService} from "../../services/redpepper.service";
export class BlockFabric extends fabric.Group {
m_block_id;
m_sceneID;
m_blockType;
m_zIndex = -1;
m_minSize = {w: 50, h: 50};
m_blockName;
m_blockAcronym;
m_blockDescription;
m_blockIcon;
m_blockFontAwesome;
m_blockSvg;
m_resourceID;
m_blockProperty;
m_blockService: BlockService;
m_pepper: RedPepperService;
constructor(options, i_blockService, i_pepper, i_blockType) {
super()
this.m_blockType = i_blockType
this.m_blockService = i_blockService;
this.m_pepper = i_pepper;
this.m_block_id = options.i_block_id;
this.m_sceneID = options.i_scene_player_data_id;
this.m_zIndex = -1;
this.m_minSize = {w: 50, h: 50};
this.m_blockName = i_blockService.getBlockBoilerplate(this.m_blockType).name;
this.m_blockAcronym = i_blockService.getBlockBoilerplate(this.m_blockType).acronym;
this.m_blockDescription = i_blockService.getBlockBoilerplate(this.m_blockType).description;
this.m_blockIcon = i_blockService.getBlockBoilerplate(this.m_blockType).icon;
this.m_blockFontAwesome = i_blockService.getBlockBoilerplate(this.m_blockType).fontAwesome;
this.m_blockSvg = i_blockService.getBlockBoilerplate(this.m_blockType).svg;
this.m_resourceID = undefined;
}
// _setBlockPlayerData(i_xmlDoc, i_noNotify, i_xmlIsString) {
// var player_data;
// if (i_xmlIsString == true) {
// player_data = i_xmlDoc;
// } else {
// player_data = (new XMLSerializer()).serializeToString(i_xmlDoc);
// }
// this.m_pepper.setScenePlayerdataBlock(this.m_sceneID, this.m_block_id, player_data);
// this.m_pepper.reduxCommit();
// // switch (this.m_placement) {
// // case PLACEMENT_SCENE: {
// // this.m_pepper.setScenePlayerdataBlock(this.m_sceneID, this.m_block_id, player_data);
// // break;
// // }
// // case PLACEMENT_IS_SCENE: {
// // this.m_pepper.setScenePlayerData(this.m_block_id, player_data);
// // break;
// // }
// // }
// }
/**
Get the XML player data of a block, depending where its placed
If you like to view XML raw data, be sure to debug domPlayerData.children[0].outerHTML
**/
_getBlockPlayerData(): any {
return this.m_pepper.getScenePlayerdataBlock(this.m_sceneID, this.m_block_id);
// to view data debug domPlayerData.children[0].outerHTML
}
/**
Find the border section in player_data for selected block
**/
_findBorder(i_domPlayerData) {
return $(i_domPlayerData).find('Border');
}
/**
Fabricate alpha to canvas
**/
_fabricAlpha(i_domPlayerData) {
var appearance = $(i_domPlayerData).find('Appearance');
var opacity: any = $(appearance).attr('alpha');
this.setOpacity(opacity);
}
/**
Fabricate color points to canvas
**/
_fabricColorPoints(i_domPlayerData) {
var gradientPoints = $(i_domPlayerData).find('GradientPoints');
var points = $(gradientPoints).find('Point');
var colorStops = {}
_.each(points, function (point) {
var color = '#' + Lib.DecimalToHex(($(point).attr('color')));
var offset: any = $(point).attr('midpoint');
offset = offset / 250;
colorStops[offset] = color;
});
return colorStops;
}
/**
Config the fabric block border
**/
_fabricateBorder(i_options) {
var domPlayerData = this._getBlockPlayerData()
var border = this._findBorder(domPlayerData);
var color = border.length == 0 ? 'transparent' : '#' + Lib.DecimalToHex($(border).attr('borderColor'));
return _.extend({
// borderColor: '#5d5d5d',
stroke: color,
strokeWidth: 1
}, i_options);
}
/**
Build the options injected into a newly created fabric object
**/
_fabricateOptions(i_top, i_left, i_width, i_height, i_angle) {
var options = {
top: i_top,
left: i_left,
width: i_width,
height: i_height,
angle: i_angle,
fill: '#ececec',
hasRotatingPoint: false,
transparentCorners: false,
cornerColor: 'black',
cornerSize: 5,
lockRotation: true,
lineWidth: 1
};
return this._fabricateBorder(options);
}
/**
Fabricate color points to canvas
**/
_fabricRect(i_width, i_height, i_domPlayerData) {
var options = this._fabricateOptions(0, 0, i_width, i_height, 0);
var r = new fabric.Rect(options);
r.setGradient('fill', {
x1: 0 - (i_width / 2),
y1: 0,
x2: (i_width / 2),
y2: 0,
colorStops: this._fabricColorPoints(i_domPlayerData)
});
return r;
}
/**
Convert the block into a fabric js compatible object, called externally on creation of block
@Override
@method fabricateBlock
**/
fabricateBlock(i_canvasScale, i_callback) {
var domPlayerData = this._getBlockPlayerData();
var layout = $(domPlayerData).find('Layout');
var w = parseInt(layout.attr('width'));
var h = parseInt(layout.attr('height'));
var rec = this._fabricRect(w, h, domPlayerData);
fabric.loadSVGFromString(this.m_blockSvg, (objects, options) => {
var groupSvg = fabric.util.groupSVGElements(objects, options);
rec.originX = 'center';
rec.originY = 'center';
groupSvg.originX = 'center';
groupSvg.originY = 'center';
var o = {
left: parseInt(layout.attr('x')),
top: parseInt(layout.attr('y')),
width: parseInt(layout.attr('width')),
height: parseInt(layout.attr('height')),
angle: parseInt(layout.attr('rotation')),
hasRotatingPoint: false,
stroke: 'transparent',
cornerColor: 'black',
cornerSize: 5,
lockRotation: true,
transparentCorners: false
};
_.extend(this, o);
this.add(rec);
this.add(groupSvg);
this._fabricAlpha(domPlayerData);
this._fabricLock();
this['canvasScale'] = i_canvasScale;
i_callback();
});
}
/**
On changes in msdb model updated UI common lock properties
**/
_fabricLock() {
var domPlayerData = this._getBlockPlayerData();
var locked: any = $(domPlayerData).attr('locked');
if (_.isUndefined(locked) || locked == '0') {
locked = false;
} else {
locked = true;
}
this.lockMovementX = locked;
this.lockMovementY = locked;
//self.lockScalingX = locked; self.lockScalingY = locked; self.lockUniScaling = locked; self.lockRotation = locked;
/////var dimensionProps = BB.comBroker.getService(BB.SERVICES['DIMENSION_PROPS_LAYOUT']);
/////if (_.isUndefined(dimensionProps))
////// return;
//////dimensionProps.setLock(locked);
}
/**
Get block data as a json formatted object literal and return to caller
**/
getBlockData() {
var data = {
blockID: this.m_block_id,
blockType: this.m_blockType,
blockName: this.m_blockName,
blockDescription: this.m_blockDescription,
blockIcon: this.m_blockIcon,
blockFontAwesome: this.m_blockFontAwesome,
blockAcronym: this.m_blockAcronym,
blockMinWidth: this.m_minSize.w,
blockMinHeight: this.m_minSize.h,
blockData: this._getBlockPlayerData()
};
return data;
}
/**
Set a block's z-index in case we know it (i.e.: it is going to be a re-render of a previous block that
was removed from the canvas)
**/
setZindex(i_zIndex) {
this.m_zIndex = i_zIndex;
}
/**
Get a block's z-index
@method getZindex
@param {Number} i_index
**/
getZindex(i_zIndex) {
return this.m_zIndex;
}
/**
Delete block is a public method used as fall back method, if not overridden by inherited instance.
It is also a semi abstract method, all implementations should go into _deleteBlock();
@method deleteBlock
@params {Boolean} i_memoryOnly if true only remove from existance but not from msdb
@return none
**/
deleteBlock(i_memoryOnly) {
/* semi-abstract, overridden, do not modify */
this._deleteBlock(i_memoryOnly);
}
/**
bug fix: backward comparability with player_data that includes deleted resources
this was already fixed but we live _selfDestruct for backwards compatability
@method _selfDestruct
**/
_selfDestruct() {
setTimeout(() => {
//todo: ???
// var sceneEditView = BB.comBroker.getService(BB.SERVICES['SCENE_EDIT_VIEW']);
// if (!_.isUndefined(sceneEditView)) {
// var selectedSceneID = sceneEditView.getSelectedSceneID();
// pepper.removeScenePlayer(selectedSceneID, self.m_block_id);
// BB.comBroker.fire(BB.EVENTS.LOAD_SCENE, this, null, selectedSceneID);
// }
}, 2000);
}
/**
Delete block is a private method that is always called regardless if instance has
been inherited or not. Used for releasing memory for garbage collector.
@method _deleteBlock
@params {Boolean} i_memoryOnly if true only remove from existance but not from msdb
@return none
**/
_deleteBlock(i_memoryOnly) {
// if (!i_memoryOnly)
// pepper.removeBlockFromTimelineChannel(this.m_block_id);
// BB.comBroker.stopListenWithNamespace(BB.EVENTS.BLOCK_SELECTED, this);
// BB.comBroker.stopListenWithNamespace(BB.EVENTS.BLOCK_LENGTH_CHANGING, this);
// BB.comBroker.stopListenWithNamespace(BB.EVENTS.GRADIENT_COLOR_CHANGED, this);
// BB.comBroker.stopListenWithNamespace(BB.EVENTS.GRADIENT_COLOR_CLOSED, this);
// BB.comBroker.stopListenWithNamespace(BB.EVENTS.BLOCK_BORDER_CHANGE, this);
// BB.comBroker.stopListenWithNamespace(BB.EVENTS.ALPHA_CHANGED, this);
// BB.comBroker.stopListenWithNamespace(BB.EVENTS.LOCK_CHANGED, this);
// $(Elements.SHOW_BACKGROUND).off(this.m_proxyToggleBgKey, this.m_proxyToggleBg);
// $(Elements.SHOW_BORDER).off(this.m_proxyToggleBorderKey, this.m_proxyToggleBorder);
// if (this.off != undefined)
// this.off('modified');
//
// if (this.m_sceneSelectedHandler)
// this.m_canvas.off('object:selected', this.m_sceneSelectedHandler);
//
// $.each(this, function (k) {
// this[k] = undefined;
// });
}
}
================================================
FILE: src/app/blocks/block-prop-calendar.ts
================================================
import {AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, Input} from "@angular/core";
import {FormBuilder, FormControl, FormGroup, Validators} from "@angular/forms";
import {BlockService, IBlockData} from "./block-service";
import {Compbaser, NgmslibService} from "ng-mslib";
import * as _ from "lodash";
import * as moment from 'moment'
@Component({
selector: 'block-prop-calendar',
host: {
'(input-blur)': 'saveToStore($event)'
},
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
{{me}}
`
})
export class BlockPropCalendar extends Compbaser implements AfterViewInit {
m_formInputs = {};
m_contGroup: FormGroup;
m_blockData: IBlockData;
m_calList = [];
m_calSeleced: any = {};
m_mode = false;
constructor(private fb: FormBuilder, private cd: ChangeDetectorRef, private bs: BlockService, private ngmslibService: NgmslibService) {
super();
this.m_contGroup = fb.group({
'token': [''],
'mode': [''],
'startDate': ['1/1/2020'],
'endDate': ['1/1/2020'],
'before': [],
'after': [],
'calSelection': ['']
});
_.forEach(this.m_contGroup.controls, (value, key: string) => {
this.m_formInputs[key] = this.m_contGroup.controls[key] as FormControl;
})
}
@Input() jsonMode: boolean;
@Input()
set setBlockData(i_blockData) {
if (this.m_blockData && this.m_blockData.blockID != i_blockData.blockID) {
this.m_blockData = i_blockData;
this._render();
} else {
this.m_blockData = i_blockData;
}
}
_saveDates(range) {
}
_onCalSelected(event) {
var calId = event.target.value;
var domPlayerData: XMLDocument = this.m_blockData.playerDataDom;
var item = jXML(domPlayerData).find('Json').find('Data');
jXML(item).attr('id', calId);
this.bs.setBlockPlayerData(this.m_blockData, domPlayerData);
}
private _render() {
var domPlayerData: XMLDocument = this.m_blockData.playerDataDom
var $data = jXML(domPlayerData).find('Json').find('Data');
var mode = $data.attr('mode');
this.m_mode = (mode == 'fixed') ? false : true;
var before = $data.attr('before');
var after = $data.attr('after');
this.m_formInputs['mode'].setValue(this.m_mode);
this.m_formInputs['after'].setValue(after);
this.m_formInputs['before'].setValue(before);
this.m_formInputs['token'].setValue($data.attr('token'));
this._getGoogleCalendars();
this._populateStartEndDates();
}
/**
Populate the start and end dates for Google calendar date range selection
If first time date component is used, set startDate and endDate where
startDate is relative to today and endDate for a week from now
@method _populateStartEndDates
**/
_populateStartEndDates(): void {
var startDate = this._getRangeDate('startDate');
var endDate = this._getRangeDate('endDate');
this.m_formInputs['startDate'].setValue(startDate);
this.m_formInputs['endDate'].setValue(endDate);
}
_setRangeDate(i_field: 'startDate' | 'endDate', i_value): void {
var domPlayerData = this.m_blockData.playerDataDom;
var xSnippet = jXML(domPlayerData).find('Json').find('Data');
var value = moment(i_value).unix() + '000';
jXML(xSnippet).attr(i_field, value);
this.bs.setBlockPlayerData(this.m_blockData, domPlayerData);
}
_getRangeDate(i_field): string {
var domPlayerData: XMLDocument = this.m_blockData.playerDataDom;
var item = jXML(domPlayerData).find('Json').find('Data');
var value: any = jXML(item).attr(i_field);
if (_.isEmpty(value)) {
var date = new Date();
var lastWeek: number = date.setDate(new Date().getDate() - 7);
var newDate = moment(lastWeek).format('YYYY-MM-DD');
return newDate;
}
value = value.slice(0, -3);
value = moment.unix(parseInt(value)).format('YYYY-MM-DD');
return value;
}
_onModeChange(i_value) {
var mode = i_value == true ? 'offset' : 'fixed';
this.m_mode = i_value;
var domPlayerData = this.m_blockData.playerDataDom;
var xSnippet = jXML(domPlayerData).find('Json').find('Data');
jXML(xSnippet).attr('mode', mode);
this.bs.setBlockPlayerData(this.m_blockData, domPlayerData);
}
_getGoogleCalendars() {
var self = this;
try {
jQuery.ajax({
url: `https://secure.digitalsignage.com/GoogleCalendarList/${self.m_contGroup.value.token}/100`,
dataType: "json",
type: "post",
complete: function (response, status) {
self.m_calSeleced = {};
self.m_calList = [];
if (_.isUndefined(response.responseText) || response.responseText.length == 0)
return;
if (response.responseText.indexOf('Cannot')>-1)
return;
var jData = JSON.parse(response.responseText);
_.forEach(jData, function (k: any) {
self.m_calList.push({
id: k.id,
label: k.summary
})
});
var id = self._getFileId();
if (id && id.length > 10)
self.m_calSeleced = self.m_calList.find(item => item.id == id);
self.m_formInputs['calSelection'].setValue(self.m_calSeleced.id);
self.cd.markForCheck()
},
error: function (jqXHR, exception) {
console.log('ajax req:' + jqXHR, exception);
}
});
} catch (e) {
console.error('error on ajax' + e);
}
}
private _getFileId(): string {
var domPlayerData: XMLDocument = this.m_blockData.playerDataDom;
var item = jXML(domPlayerData).find('Json').find('Data');
return jXML(item).attr('id');
}
ngAfterViewInit() {
this._render();
}
_onCreateToken() {
var win = window.open('http://google.signage.me', '_blank');
if (win) {
win.focus();
} else {
bootbox.alert('Browser popups are blocked, please enable and try again');
}
}
private saveToStore() {
// Lib.Con(this.m_contGroup.status + ' ' + JSON.stringify(this.ngmslibService.cleanCharForXml(this.m_contGroup.value)));
if (this.m_contGroup.status != 'VALID')
return;
var domPlayerData: XMLDocument = this.m_blockData.playerDataDom;
var item = jXML(domPlayerData).find('Json').find('Data');
jXML(item).attr('before', this.m_contGroup.value.before);
jXML(item).attr('after', this.m_contGroup.value.after);
jXML(item).attr('token', this.m_contGroup.value.token);
this._setRangeDate('startDate',this.m_contGroup.value.startDate)
this._setRangeDate('endDate',this.m_contGroup.value.endDate)
this.bs.setBlockPlayerData(this.m_blockData, domPlayerData);
}
destroy() {
}
}
================================================
FILE: src/app/blocks/block-prop-clock.ts
================================================
import {AfterViewInit, ChangeDetectionStrategy, Component, Input} from "@angular/core";
import {FormBuilder} from "@angular/forms";
import {BlockService, IBlockData} from "./block-service";
import {RedPepperService} from "../../services/redpepper.service";
import {Compbaser} from "ng-mslib";
import {IFontSelector} from "../../comps/font-selector/font-selector";
import {Lib} from "../../Lib";
@Component({
selector: 'block-prop-clock',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
{{me}}
`
})
export class BlockPropClock extends Compbaser implements AfterViewInit {
m_blockData: IBlockData;
m_fontConfig: IFontSelector;
m_clockFormats = [{
type: 'longDateAndTime',
format: 'Friday, Mar 21 2018 at 8:59AM'
}, {
type: 'longDate',
format: 'Friday, Mar 21 2018'
}, {
type: 'shortDayTime',
format: 'Friday 9:10 AM'
}, {
type: 'date',
format: '3/21/18'
}, {
type: 'time',
format: '9:00:39 AM'
}];
m_model = {
options: this.m_clockFormats[0]
};
constructor(private fb: FormBuilder, private rp: RedPepperService, private bs: BlockService) {
super();
}
@Input()
set setBlockData(i_blockData) {
if (this.m_blockData && this.m_blockData.blockID != i_blockData.blockID) {
this.m_blockData = i_blockData;
this._render();
} else {
this.m_blockData = i_blockData;
}
}
_onFontChanged(config: IFontSelector) {
var domPlayerData = this.m_blockData.playerDataDom;
var xSnippet = jXML(domPlayerData).find('Clock');
var xSnippetFont = jXML(xSnippet).find('Font');
config.bold == true ? xSnippetFont.attr('fontWeight', 'bold') : xSnippetFont.attr('fontWeight', 'normal');
config.italic == true ? xSnippetFont.attr('fontStyle', 'italic') : xSnippetFont.attr('fontStyle', 'normal');
config.underline == true ? xSnippetFont.attr('textDecoration', 'underline') : xSnippetFont.attr('textDecoration', 'none');
xSnippetFont.attr('fontColor', Lib.ColorToDecimal(config.color));
xSnippetFont.attr('fontSize', config.size);
xSnippetFont.attr('fontFamily', config.font);
xSnippetFont.attr('textAlign', config.alignment);
this.bs.setBlockPlayerData(this.m_blockData, domPlayerData);
}
_onFormatChanged(e) {
var mask = this.bs.getBlockBoilerplate(this.m_blockData.blockCode).getDateTimeMask(e.type);
var domPlayerData = this.m_blockData.playerDataDom;
var xSnippet = jXML(domPlayerData).find('Clock');
xSnippet.attr('clockMask', mask);
this.bs.setBlockPlayerData(this.m_blockData, domPlayerData);
}
ngAfterViewInit() {
this._render();
}
_render() {
var self = this;
var domPlayerData = this.m_blockData.playerDataDom;
var xSnippet = jXML(domPlayerData).find('Clock');
var mask = jXML(xSnippet).attr('clockMask');
var xSnippetFont = jXML(xSnippet).find('Font');
this.m_clockFormats.forEach(i_clockFormat => {
var currMask = self.bs.getBlockBoilerplate(self.m_blockData.blockCode).getDateTimeMask(i_clockFormat.type);
if (mask == currMask) {
this.m_model = {options: i_clockFormat};
}
});
this.m_fontConfig = {
size: Number(xSnippetFont.attr('fontSize')),
alignment: xSnippetFont.attr('textAlign'),
bold: xSnippetFont.attr('fontWeight') == 'bold' ? true : false,
italic: xSnippetFont.attr('fontStyle') == 'italic' ? true : false,
font: xSnippetFont.attr('fontFamily'),
underline: xSnippetFont.attr('textDecoration') == 'underline' ? true : false,
color: Lib.ColorToHex(Lib.DecimalToHex(xSnippetFont.attr('fontColor'))),
}
}
destroy() {
// console.log('destroy html component');
}
}
================================================
FILE: src/app/blocks/block-prop-collection.ts
================================================
import {AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, Input, ViewChild} from "@angular/core";
import {FormBuilder, FormControl, FormGroup} from "@angular/forms";
import {BlockService, IBlockData} from "./block-service";
import {Compbaser, NgmslibService} from "ng-mslib";
import * as _ from "lodash";
import {List} from "immutable";
import {ISimpleGridEdit} from "../../comps/simple-grid-module/SimpleGrid";
import {StoreModel} from "../../store/model/StoreModel";
import {SimpleGridRecord} from "../../comps/simple-grid-module/SimpleGridRecord";
import {SimpleGridTable} from "../../comps/simple-grid-module/SimpleGridTable";
import {ISimpleGridDraggedData} from "../../comps/simple-grid-module/SimpleGridDraggable";
import {JsonEventResourceModel} from "./json-event-grid";
import {Lib} from "../../Lib";
import {ModalComponent} from "ng2-bs3-modal/ng2-bs3-modal";
import {IAddContents} from "../../interfaces/IAddContent";
import {BlockLabels, PLACEMENT_LISTS, PLACEMENT_SCENE} from "../../interfaces/Consts";
import {RedPepperService} from "../../services/redpepper.service";
import {IUiState} from "../../store/store.data";
import {ACTION_UISTATE_UPDATE, SideProps} from "../../store/actions/appdb.actions";
import {YellowPepperService} from "../../services/yellowpepper.service";
@Component({
selector: 'block-prop-collection',
host: {
'(input-blur)': 'saveToStore($event)'
},
styles: [`
/* walk up the ancestor tree and if darkTheme is found, apply style */
/*:host-context(.darkTheme) * {*/
/*background-color: #1e1e1e;*/
/*}*/
`],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
{{me}}