diff options
author | horchi <vdr@jwendel.de> | 2017-03-05 16:39:28 +0100 |
---|---|---|
committer | horchi <vdr@jwendel.de> | 2017-03-05 16:39:28 +0100 |
commit | e2a48d8701f91b8e24fbe9e99e91eb72a87bb749 (patch) | |
tree | 726f70554b4ca985a09ef6e30a7fdc8df089993c /http/src | |
download | vdr-epg-daemon-e2a48d8701f91b8e24fbe9e99e91eb72a87bb749.tar.gz vdr-epg-daemon-e2a48d8701f91b8e24fbe9e99e91eb72a87bb749.tar.bz2 |
git init1.1.103
Diffstat (limited to 'http/src')
-rw-r--r-- | http/src/css/epgd.less | 1724 | ||||
-rw-r--r-- | http/src/css/theme/default.less | 7 | ||||
-rw-r--r-- | http/src/js/1_main.js | 714 | ||||
-rw-r--r-- | http/src/js/5_timerDialog.js | 640 | ||||
-rw-r--r-- | http/src/js/channels.js | 46 | ||||
-rw-r--r-- | http/src/js/epgd | 3 | ||||
-rw-r--r-- | http/src/js/eventDetail.js | 523 | ||||
-rw-r--r-- | http/src/js/pages.editChannels.js | 313 | ||||
-rw-r--r-- | http/src/js/pages.editUser.js | 96 | ||||
-rw-r--r-- | http/src/js/pages.help.js | 49 | ||||
-rw-r--r-- | http/src/js/pages.login.js | 114 | ||||
-rw-r--r-- | http/src/js/pages.magazine.js | 413 | ||||
-rw-r--r-- | http/src/js/pages.now.js | 135 | ||||
-rw-r--r-- | http/src/js/pages.profile.js | 251 | ||||
-rw-r--r-- | http/src/js/pages.records.js | 453 | ||||
-rw-r--r-- | http/src/js/pages.timer.js | 743 | ||||
-rw-r--r-- | http/src/js/vdr.js | 57 | ||||
-rw-r--r-- | http/src/lang/de.js | 299 | ||||
-rw-r--r-- | http/src/lang/hilfe.html | 303 |
19 files changed, 6883 insertions, 0 deletions
diff --git a/http/src/css/epgd.less b/http/src/css/epgd.less new file mode 100644 index 0000000..51a9c90 --- /dev/null +++ b/http/src/css/epgd.less @@ -0,0 +1,1724 @@ +/* Hier sind Variablen aus Jquery-ui. Sie werden folgendermass erstellt: + aus 3rdParty\jquery-ui-x:x.custom\development-bundle\themes\humanity\jquery-ui.css den Link kopieren und hier einfügen. + Dann diesen Link (nur Auswahl) per regulären Ausdruck + suchen "$([^=]+)=([^&]+)" und ersetzen "@$1: $2; " + suchen " ([a-f0-9]{6})" und ersetzen " #$1" +*/ +@ui-fwDefault: normal; +@ui-fsDefault: 1.1em; +@ui-cornerRadius: 6px; +@ui-bgColorHeader: #cb842e; +@ui-bgTextureHeader: glass; +@ui-bgImgOpacityHeader: 25; +@ui-borderColorHeader: #d49768; +@ui-fcHeader: #ffffff; +@ui-iconColorHeader: #ffffff; +@ui-bgColorContent: #f4f0ec; +@ui-bgTextureContent: inset_soft; +@ui-bgImgOpacityContent: 100; +@ui-borderColorContent: #e0cfc2; +@ui-fcContent: #1e1b1d; +@ui-iconColorContent: #c47a23; +@ui-bgColorDefault: #ede4d4; +@ui-bgTextureDefault: glass; +@ui-bgImgOpacityDefault: 70; +@ui-borderColorDefault: #cdc3b7; +@ui-fcDefault: #3f3731; +@ui-iconColorDefault: #f08000; +@ui-bgColorHover: #f5f0e5; +@ui-bgTextureHover: glass; +@ui-bgImgOpacityHover: 100; +@ui-borderColorHover: #f5ad66; +@ui-fcHover: #a46313; +@ui-iconColorHover: #f08000; +@ui-bgColorActive: #f4f0ec; +@ui-bgTextureActive: highlight_hard; +@ui-bgImgOpacityActive: 100; +@ui-borderColorActive: #e0cfc2; +@ui-fcActive: #b85700; +@ui-iconColorActive: #f35f07; +@ui-bgColorHighlight: #f5f5b5; +@ui-bgTextureHighlight: highlight_hard; +@ui-bgImgOpacityHighlight: 75; +@ui-borderColorHighlight: #d9bb73; +@ui-fcHighlight: #060200; +@ui-iconColorHighlight: #cb672b; +@ui-bgColorError: #fee4bd; +@ui-bgTextureError: highlight_hard; +@ui-bgImgOpacityError: 65; +@ui-borderColorError: #f8893f; +@ui-fcError: #592003; +@ui-iconColorError: #ff7519; +@ui-bgColorOverlay: #aaaaaa; +@ui-bgTextureOverlay: flat; +@ui-bgImgOpacityOverlay: 75; +@ui-opacityOverlay: 30; +@ui-bgColorShadow: #aaaaaa; +@ui-bgTextureShadow: flat; +@ui-bgImgOpacityShadow: 75; +@ui-opacityShadow: 30; +@ui-thicknessShadow: 8px; +@ui-offsetTopShadow: -8px; +@ui-offsetLeftShadow: -8px; +@ui-cornerRadiusShadow: 8px; + +h5 { + margin-bottom: 5px; +} + +.ui-autocomplete-multiselect { + display: inline-block; + background: #fff !important; + border: 1px solid @ui-borderColorContent; + border-radius: 6px; + padding: 1px 3px 0 3px; + overflow: hidden; + cursor: text; + font-size: 0.8em; + vertical-align: bottom; +} + +.ui-autocomplete-multiselect .ui-autocomplete-multiselect-item .ui-icon { + float: right; + cursor: pointer; +} + +.ui-autocomplete-multiselect .ui-autocomplete-multiselect-item { + display: inline-block; + border: 1px solid #ccc; + border-radius: 4px; + padding: 1px 3px; + margin-right: 2px; + margin-bottom: 1px; + background-color: @ui-bgColorContent; + font-size: 0.8em; +} + +.ui-autocomplete-multiselect input { + display: inline-block; + border: none; + outline: none; + height: auto; + margin: 2px; + overflow: visible; + margin-bottom: 5px; + text-align: left; + background: #fff !important; +} + +.ui-autocomplete { + max-height: 120px; + overflow-y: auto; + overflow-x: hidden; +} + + +.ui-autocomplete-category { + font-weight: bold; + padding: .2em .4em; + margin: .8em 0 .2em; + line-height: 1.5; +} + +.placeholders {
+ position: absolute;
+ max-height: 120px;
+ overflow: auto;
+} +.ui-dialog{position:fixed} + + +.iAsButton { + border: 1px solid @ui-borderColorDefault; + background-color: @ui-bgColorDefault; + color: @ui-iconColorContent; + border-radius: @ui-cornerRadius; + text-align: center; + padding: 3px; + display: inline-block; + text-decoration: none; + cursor: pointer; + margin: 3px; + white-space: nowrap; + + &[disabled] {
+ opacity: .35;
+ } +} + +.iAsIcon { + text-align: center; + display: inline-block; + text-decoration: none; + cursor: pointer; + margin: 3px; + white-space: nowrap; + padding: 0; + font-size: 0.9em; + vertical-align: 6px; + margin-top: -6px; + border: 1px solid @ui-borderColorDefault; + background-color: @ui-bgColorDefault; + color: @ui-iconColorContent; + border-radius: 50%; + font-size: 0.8em; +} + +.i-ok { + color: green; +} + +.i-warning { + color: #f2e339; +} +.i-error { + color: #f16241; +} +.i-flash-outline { + color: #f90000; +} +.i-progress { + color: #c47a23; +} + + +/* ========================================================================== + EPGd + ========================================================================== */ +@epgdSprite: url(images/epg_icons_24x24_orange.png); + +html{ + width:100%; +} +body { + margin: 0; + padding: 30px 0 0 0; + font-size: 0.8em; + width:100%; + overflow:auto; +} + +input, select { + padding: 2px; + border: 1px solid @ui-borderColorContent; + border-radius: 6px; + vertical-align: middle; + font-weight:normal; +} + +select { + border-top-right-radius: 0; + border-bottom-right-radius: 0; + // border-right:none; +} + +.full { + width: 98%; +} + +.quickInfo { + max-width: 80%; + max-height: 80%; + overflow-y: auto; +} + +#menu-top { + //min-width: 320px; + width: 100%; + margin:0 auto; + white-space:normal; + //overflow: hidden; + position: fixed; + z-index: 99; + top: 0; + left: 0; + //border: 5px solid white; + //border-width: 0px 0px 5px 0px; + background-color: #fff; + + span.maxi {
+ display:none;
+ } +
+ .iAsButton {
+ padding: 0 2px;
+ line-height: 21px;
+ margin-top: 0;
+ } + + &.mini{ + span.maxi { + display: block; + position: absolute; + padding:0 10px; + right:0; + top: 2px; + font-size: 1.3em; + } + > ul { + padding-right: 40px; +// overflow-y:visible; + + > li { + display: none; + float: left; + max-width:95%; + } + } + } + &.open { + z-index: 9999; + + > ul { + padding: 10px 0 10px 10px; + + > li { + display: block; + float: left; + min-width: 90%; + min-height: 25px; + > a {
+ width:100%;
+ } + } + } + .ui-datepicker {display:none} + } +} + +#ui-menu-top { + overflow: hidden; + min-height:30px; + + .ui-menu { + position:fixed; + overflow: visible !important; + padding-top: 5px; + z-index: 99; + } + + > li { + float: left; + display: block; + width: auto !important; + border: 1px solid transparent; + margin: 1px 5px !important; + padding: 0 0 !important; + line-height: 24px; + outline: none; + + > a { + float: left; + display: block; + clear: both; + overflow: hidden; + text-decoration: none; + } +
+ span.ui-menu-icon {
+ display:none;
+ } + } + .menu-active { + display: block !important; + + > a { + color: @ui-fcActive; + font-weight: bold; + min-height: 25px; + } + } + + ul li { + display: block; + float: none; + + ul { + left: 120px !important; + width: 100%; + + li { + width: auto; + + a { + float: left; + } + } + } + } + +/* + + #ui-menu-top .ui-menu li { + float: left; + display: block; + } +*/ + input, select { + display: none; + float: left; + font-size: 1em; + margin: 0 0 0 5px; + } + input, select { + padding:3px; + } +} + +#menu_login { + float: right; + margin-right: 20px !important; +} + +.menu-active input, .menu-active select { + display: block; + visibility: visible; +} + +.ui-tabs { + position: static; + border: 1px solid @ui-borderColorContent; +} + +#tabCon { + padding: 10px; +} + +table.ui-datepicker-calendar { + width: 40%; + float: left; + margin: 10px 2% 5px 0; + font-size: 1em; +} + +.ui-datepicker { + width: auto; +} + +.ui-timepicker-div { + width: 53%; + min-width: 230px; + float: left; + margin: 3px 0 0 0; + + dl dd { + margin: 0 10px 0 4px; + } + + dt { + float: none !important; + font-weight: bold; + } + + span { + float: left; + line-height: 0.8; + margin-bottom: 10px; + } + u { + margin: 0px 0px 10px 10px; + text-align: right; + //font-size: 0.9em; + min-width: 16px; + cursor: pointer; + display: inline-block; + } + i { + padding-right: 17px; + background: url(images/epg_icons_24x24_orange.png) no-repeat 45px -1831px; + display:inline-block; + } +} + +.channel { + width:80px; + overflow: hidden; + font-weight: bold; + font-size: 10px; + line-height: 1; + color: #4d4949; + padding: 3px 5px 0 3px; + img {
+ max-width: 70px;
+ max-height: 50px;
+ margin-right: 5px;
+ margin-bottom: 5px;
+ display:block;
+ } + .i-tv { + font-size: 1.8em; + line-height: 1.3em; + margin-left: -4px; + cursor: pointer; + } +} + +.popup { + z-index: 8888; +} + +.topInfo { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + height: 36px; + padding: 6px 0.7em; + z-index: 100000; + position: fixed; + top: 0; + right: 30px; + + button { + margin: -4px 0 0 10px; + } +} + +#content { + text-align: center; + width: 96%; + padding: 0; + margin: 0 auto; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + + > * { + text-align: left; + } +} + +.teaserList { + padding: 0px; + margin: 0px auto; + list-style: none; + display: block; + + li { + padding: 1px 3px 3px 3px; + margin: 0.5% 1%; + overflow: hidden; + width: 98%; + min-height: 70px; + -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ + -moz-box-sizing: border-box; /* Firefox, other Gecko */ + box-sizing: border-box; /* Opera/IE 8+ */ + + } + .desc {
+ height: 72px;
+ overflow: hidden;
+ &:hover{
+ min-height: 72px;
+ height:auto;
+ overflow-y:visible;
+ }
+ } + + .desc img { + float: right; + margin: 0px 0px 2px 5px; + } + + .time { + float: left; + font-size: 0.9em; + } + .date { + float: right; + font-size: 0.9em; + } + .tipp {
+ margin:1px 5px 0 0;
+ } + + .title { + font-weight: bold; + margin-top: 8px; + //font-size: 1.1em; + } + +} + +#pageNow { + li { + padding-left: 90px; + } + + .channel { + float: left; + margin-left: -87px; + cursor: pointer; + img {max-height:70px} + } +} + +#magazine-nav{
+ +// overflow:hidden; + width:100%;
+ left:-27px;
+ position:relative;
+
+ .left, .right { + width: 50px; + height:54px; + border-top: none; + border-bottom: none; + position: absolute; + z-index: 98;
+ top:0; + + .ui-widget-content { + width: 50px; + margin: 0 -1px; + text-align: center; + padding-top: 1px; + border-bottom: none; + } + + span { + margin: 0px auto 1px auto; + } + } + .left { + left:0; + //border-right: 5px solid white; + }
+ .right { + right: 0; + //border-left: 5px solid white; + } + +}
+ + +#magazine-head { + margin: 0 0 0 -2%;
+ height: 55px; + padding: 0 0 0 54px; + overflow:hidden; + + .ui-widget-content { + margin: 0 3px; + width: 200px; + height: 55px; + float: left; + + .channel { + height: 55px; + width:auto; + img { + max-width:100px;
+ float:left;
+ } + } + } +} + + + +#magazine { + padding: 0 0 0 54px; + margin: 0 0 0 -2%; + overflow-x: hidden; + overflow-y: scroll; + position: relative; + clear: left; + + .timeNow { + position: absolute; + border-top: 2px solid red; + z-index: 99; + left: 0; + color: red; + font-weight: bold; + padding: 0 0 0 8px; + margin: 0; + opacity: 0.5; + } + + > div { + margin: 0; + padding: 0; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + + > div { + float: left; + width: 200px; + min-height: 90%; + margin: 0 3px; + + &.timeLine { + width: 50px; + //font-size: 0.8em; + margin: 0 0 0 -1px; + left: 0; + position: absolute; + z-index: 99; + + p {
+ position: absolute; + pointer-events:none;
+ width: 5000px;
+ height: 180px;
+ background-color: red !important;
+ opacity: 0.1;
+ } + + &.tlr{
+ p{display:none}
+ } + dfn { + height: 120px; + text-align: center; + box-sizing: border-box; + padding-top: 10px; + display: block; + + &:nth-of-type(2n+1) { + background-color: #ddd; + } + } + } + } + + + dt { + //border-top: 2px solid @ui-borderColorContent; + //border-left: 4px solid transparent; + //padding: 4px 4px 4px 1px; + border: 2px solid transparent; + border-top-color: @ui-borderColorContent; + padding: 1px 4px; + width: 200px; + margin: 0; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + + &:hover { + overflow-y: visible; + height: auto !important; + } + + .time { + font-size: 0.9em; + float: left; + + * { + display: block; + float: left; + width: 40px; + } + //b { text-align: center; } + } + + img { + float: right; + } + + .title { + font-size: 0.9em; + font-weight: bold; + clear: both; + } + + .desc { + margin-top: 5px; + border: none; + clear:both; + } + } + } +} + +.desc { + font-size: 0.9em; + border: 1px solid @ui-borderColorContent; + border-width: 1px 0 0 0; + margin-top: 20px; + + span { + font-weight: bold; + color: #ae0a0a; + margin-right: 5px; + } +} + +.progress { + border: 1px solid @ui-borderColorContent; + float: right; + margin-top: 3px; + width: 100px; + height: 10px; + + > div { + background-color: @ui-bgColorHeader; + height: 8px; + margin-top: 1px; + } +} + +#eventDetail { + position: fixed; + display: none; + z-index: 100; + min-width: 320px; + width: 432px; + height: 80%; + min-height: 440px; + padding: 0; + + .ui-accordion-content { + padding: 0; + + a { + margin-right: 5px; + } + } + + .toolbar { + text-align: center; + float: left; + width: 100%; + padding: 2px; + box-sizing: border-box; + + button { + font-size: 1.2em; + } + } + + .title { + display: inline-block; + margin-left: 10px; + overflow: hidden; + text-align: center; + width: 100px; + //height: 18px; + } + + h3 { + cursor: auto; + vertical-align: top; + text-align: center; + font-size: 0.8em; + padding: 3px 140px 0; + overflow: hidden; + height: 18px; + clear:both; + + div { + position: absolute; + top: 3px; + display: inline-block; + //background:@ui-bgColorContent; + padding: 0 5px; + + &.date { + left: 20px; + } + + &.time { + right: 0; + } + } + } + + .imgBox { + //margin: 10px 0 0 10px; + padding: 4px; + display: table-cell; + position: relative; + border: 1px solid #ccc; + border-radius: 4px; + width: 270px; + float: left; + min-height: 120px; + + img { + display: block; + margin: auto; + } + } + + .chPrFl { + width: 105px; + margin: -5px 0 0 10px; + float: left; + font-size: 0.8em; + + > div { + width: 100px; + float: left; + margin-top: 5px; + } + + .channel { + text-align: center; + //height: 75px; + font-size: 12px; + border: 1px solid #ccc; + border-radius: 4px; + img {
+ margin: 0 auto 5px auto;
+ } + } + + .audio { + span { + height: 16px; + min-width: 25px; + margin: 0 8px 0 0; + background-image: @epgdSprite; + background-repeat: no-repeat; + display: inline-block; + } + } + } + + .info { + float: left; + margin: 10px 10px 0 0; + min-width: 135px; + font-size: 0.9em; + + b { + margin-left: 5px; + } + } + + .col2 { + float: left; + width: 280px; + margin: 10px 10px 0 0; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + } + + .rate {
+ background-size: 25px;
+ min-height:40px;
+ padding-left: 30px;
+ > span {
+ display: block;
+ font-size: 1.2em;
+ }
+ } + .tipp{
+ margin:0 5px 0 0;
+ } + + .stars { + div { + height: 16px; + width: 80px; + margin: 2px 0 5px 0; + background-image: @epgdSprite; + background-repeat: no-repeat; + } + } + + div.stars { + font-size: 0.9em; + float: right; + margin: 10px 10px 0 0; + text-align: center; + clear: both; + } + + td.stars { + div { + float: left; + margin-right: 20px; + } + } + + .colFull { + float: left; + width: 405px; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + margin: 10px 0 0 10px; + + > img { + margin: 10px 0 0 0; + vertical-align: top; + } + } + + .desc { + padding: 5px 10px 5px 0px; + } + + table { + //font-size: 0.8em; + border-collapse: collapse; + //margin: 10px 0 0 10px; + th, td { + text-align: left; + border: 1px solid @ui-borderColorContent; + padding: 2px 3px; + } + } + + .poster { + float: left; + margin: 10px 10px 0 10px; + } + + .actors { + font-size: 0.9em; + //padding-left: 10px; + h5 { + margin: 10px 0 0; + font-size: 1.1em; + } + + div { + float: left; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + padding: 10px 10px 0 65px; + width: 195px; + min-height: 100px; + + a { + display: block; + font-weight: bold; + } + + img { + max-width: 60px; + max-height: 90px; + float: left; + margin-left: -65px; + } + } + } + .rec {
+ font-size:0.9em;
+ } +} + +.hasTimer { + color: red; + font-weight: bold; +} + +.stars1 { + background-position: 0 -465px; +} +.stars2 { + background-position: 0 -491px; +} +.stars3 { + background-position: 0 -517px; +} +.stars4 { + background-position: 0 -543px; +} +.stars5 { + background-position: 0 -570px; +} +.a-169 { + background-position: 0 -784px; +} +.a-dd { + background-position: 0 -712px; +} + +.parRate6 { + background: @epgdSprite no-repeat 0 -1558px; + height: 30px; + width: 30px; + color: transparent; + float: right; +} +.parRate12 { + background: @epgdSprite no-repeat 0 -1520px; + height: 30px; + width: 30px; + color: transparent; + float: right; +} +.parRate16 { + background: @epgdSprite no-repeat 0 -1634px; + height: 30px; + width: 30px; + color: transparent; + float: right; +} +.parRate18 { + background: @epgdSprite no-repeat 0 -1596px; + height: 30px; + width: 30px; + color: transparent; + float: right; +} +
+.rate {
+ background: url() no-repeat left top;
+ background-size: 18px;
+ min-height:35px;
+ padding-left: 25px;
+ margin: 5px 0;
+ float: left; + clear:left; + display:block;
+} + +.rate1{ background-image: url('images/thumb-rate1.svg');} +.rate2{ background-image: url('images/thumb-rate2.svg'); background-size:25px} +.rate3{ background-image: url('images/thumb-rate3.svg');} +.rate4{ background-image: url('images/thumb-rate4.svg');} +.rate5{ background-image: url('images/thumb-rate5.svg');} +.rate0{ background:none; height:auto;padding-left:inherit} + +.tipp{
+ display:block;
+ float: left;
+ margin:5px 0;
+ background-color: rgb(245, 126, 126);
+ color: white;
+ border-radius: @ui-cornerRadius;
+ padding: 1px 3px;
+ font-size: 0.9em;
+ font-weight: normal;
+} + +#searchResult { + overflow-y: auto; + overflow-x: visible; + border-top: 1px solid @ui-bgColorHeader; + box-sizing: border-box; + padding-right:1px; +} + +.timerTable { + min-width: 400px; + width:100%; + + &.sub { + background-color: white; + border: 3px double @ui-borderColorContent; + } + + td { + border: 1px solid @ui-borderColorContent; + padding: 2px 5px; + vertical-align: top; + + .channel { + img {
+ max-height:30px;
+ } + } + } + + /* p { + border-top: 1px solid #ccc;
+ height: 18px;
+ margin: 0;
+ overflow-y: hidden; + + &:hover { + overflow-y: visible; + height: auto !important; + } + } + }*/ + + th { + text-align: left; + vertical-align: top; + padding: 2px 5px; + display: table-cell; + } + + span { + float: right; + } + + .i-sort-name-up { + margin-right: 0; + } + + .i-sort-name-down { + margin-left: 0; + } +} + +#timerList { + td { + &:nth-child(6) { + cursor: pointer; + } + } +} +#timerSearchList {
+ max-width:750px;
+} +.searchDialog { + min-width: 320px; + //max-width: 650px; + position: relative; + + #tTitle { + cursor: pointer; + text-align: center; + text-decoration: underline; + } + + >form{
+ >div{
+ margin-bottom:5px;
+ margin-top: 5px;
+ } + &.noAdv{
+ >div + div {display: none}
+ } + } + + label { + //display: block; + margin: 5px 5px 0 0; + font-weight: bold; + color: #666; + cursor: pointer; + } + + input.hasDatepicker[disabled] { + border: none; + background-color: transparent; + width: 20px; + } + + .week { + border: 1px solid @ui-borderColorContent; + margin: 5px 0; + padding: 5px 0; + width: 99%; + + > input[type=checkbox], > span { + width: auto; + margin-left: 2%; + margin-right: 2px; + line-height: 2em; + } + } + + .colBlock { + width:100%;
+ float: left; + div { + float: left; + margin-right: 10px; + + label { + display: block; + } + } + } + form.typeS {
+ .noTypeS, .onlyTypeR {display:none}
+ } + form.typeV {
+ .onlyTypeR, .onlyTypeS {display:none}
+ } + form.typeR {
+ .onlyTypeS {display:none}
+ } +} + +.selMarkBlock { + display: inline-block; + text-align: center; + width: 34px; + float: left; + font-size: 0.8em; + + b { + border: 1px solid #CCCCCC; + border-radius: 6px; + float: left; + margin: 5px 3px 0 0; + padding-left: 5px; + height: 13px; + width: 20px; + + b { + border: medium none; + border-radius: 6px 0 0 6px; + margin: 0 0 0 -5px; + width: 7px; + height: 13px; + } + } +} + +#records { + margin-left: -20px; +/* 23.11.16 brauchen wir das noch??? + .ui-menu li { + padding: 2px 5px; + + &:hover { + border: 1px solid @ui-borderColorHover; + } + }*/ + + .folder { + //clear: left; + padding: 0 0 0 20px; + + h4 { + margin: 3px 0; + display: inline-block; + span {
+ font-weight: normal;
+ padding-right: 3px;
+ } + } + + div, m { + display: none; + } + + &.open,&.tmp-open { + > h4 { + > span:before { + content: '\e80a'; // folder open + } + + > m { + display: inline; + } + + > m:before { + content: '\e80b'; // menu + } + // menu + } + + > div { + display: block; + } + } + + } +
+} +.rec { + border: 1px solid @ui-borderColorDefault; + border-radius: 6px; + margin: 2px 20px; + //clear: left; + //width: 80%; + padding: 0 140px 0 70px; + background-color: @ui-bgColorContent; + position: relative; + + u { + display: block; + position: absolute; + margin-left: -60px; + padding: 2px 0; + } + + b { + display: block; + background-color: white; + padding: 2px 5px; + + i { + display: block; + font-weight: normal; + } + } + + em { + display: block; + position: absolute; + right: 10px; + top: 0; + padding: 2px 0; + } +} + #recBar{
+ font-size:0.9em;
+ display:inline-block;
+ } + + body.dd-open{
+ #ui-menu-top, #recBar{
+ display:none !important;
+ }
+ #records{ + .folder {
+ display:block;
+ } + div.rec{
+ display:none;
+ } + }
+
+ } + +.pageEditChannels > li { + border: 1px solid #CCCCCC; + border-radius: 6px; + clear: left; + float: left; + margin-top: 5px; + padding-left: 5px; + width: 96%; + + &.filterHide {
+ height:0;
+ overflow:hidden;
+ margin:0;
+ border:none;
+ } + +} + + +#pageEditChannelsHead { + border-bottom: 3px double #CCCCCC; + font-size: 0.9em; + margin: 10px 0 0 10px; + width: 600px; + float: none; + + em { + padding: 3px; + line-height: 0; + } +} + +.pageEditChannels { + font-size: 0.9em; + margin: 0; + width: 600px; + overflow-y: auto; + float: left; + + em { + cursor: pointer; + float: left; + margin: 3px 10px 0 0; + font-size: 1.2em; + } + + span { + display: inline-block; + float: left; + padding: 5px 10px 5px 0; + width: 180px; + } + + > li > input { + float: left; + margin-top: 3px; + width: 180px; + } + + ol { + background: none repeat scroll 0 0 #EEEEEE; + border-radius: 6px; + display: inline-block; + float: left; + margin: 3px 10px; + padding: 2px 5px 2px 20px; + min-height: 15px; + font-size: 0.7em; + + input { + margin-top: 3px; + width: 40px; + } + } +} + +#pageEditChannels { + border-bottom: 1px solid #CCCCCC; +} + +#pageEditChannelsSource { + width: 350px; + margin-top: 5px; + + i { + padding: 5px 10px 5px 0; + float: left; + } +} + +.selected { + background-color: #F39814; +} + +#page_profile { + td { + padding: 5px; + vertical-align: top; + } +} + +#page_editUser {
+ >div {
+ float:left;
+ height:350px;
+ padding-right:20px;
+ margin-right:20px;
+ border-right:2px solid #ccc;
+ }
+ h2 {
+ margin: 5px 0 2px 0;
+ font-size:1em
+ }
+ form {float:left}
+ select{
+ overflow:auto; height:200px
+ }
+} + +/* ========================================================================== + Media Queries + ========================================================================== */ +@media only screen and (max-width: 420px) { + body { + font-size: 1em; + } + + ui-icon { + margin: 6px; + } + + .ui-timepicker-div { + + u { + min-width: 21px; + } + i { + background-position: 53px -1828px; + } + } + + .teaserList .desc img, #eventDetail .ui-widget-shadow { + display: none; + } + + .teaserList { + .time,.date {font-size: 0.8em;} + .tipp {font-size: 0.7em;margin-top:2px} + .progress {width:40px} + } + + #eventDetail { + width: 100%; + height: 60%; + position: fixed; + + .colFull { + width: 100%; + margin: 0; + } + + .imgBox:empty { + display: none; + } + + .col2 { + width: 165px; + } + + .info:nth-child(2n+1) { + clear: both; + } + + .stars { + clear: none !important; + float: left; + margin-left: 10px; + } + + + .desc { + width: 300px; + } + } + + .searchDialog { + width: 320px; + } + + #magazine-nav {
+ top:-10px;
+ .left{margin-left:-1px;}
+ .right{margin-right:-1px;}
+ } + + #magazine-head { + .ui-widget-content { + height: 65px; + } + .prev {height:auto} + } + #magazine .tlr {display:none} + + #records { + margin-left:-5px; + + + .folder { + padding: 0 0 0 5px; + } + } + .rec { + margin: 2px; + padding: 0; + border-bottom-left-radius: 0;
+ border-bottom-right-radius: 0; + + u { + position: inherit; + margin-left: 2px; + } + }
+} + +@media only screen and (min-width: 768px) and (max-width:1139px) { + #pageNow li { + float: left; + width: 48%; + } + + #pageNow li:nth-child(2n+1) { + clear: left; + } + + #eventDetail { + width: 700px; + + h3 { + font-size: 1em; + padding: 3px 170px 0; + height: 20px; + } + + .desc { + border-width: 0 0 0 1px; + height: 100%; + margin-top: 0; + //margin-left: 10px; + padding: 5px 10px; + } + + .desc, .actors { + width: 270px; + } + + .poster, table.colFull, table.colFull img { + width: 320px; + } + } +} + +@media only screen and (min-width: 900px) { + #eventDetail { + width: 850px; + + h3 { + font-size: 1em; + padding: 3px 170px 0; + height: 20px; + } + + .desc { + border-width: 0 0 0 1px; + height: 100%; + margin-top: 0; + //margin-left: 10px; + padding: 5px 10px; + } + + .desc, .actors { + width: 405px; + } + + .poster { + float: right; + } + } +} + +@media only screen and (min-width: 1140px) { + .content { + width: 1026px; /* 1140px - 10% for margins */ + margin: 0 auto; + } + + #pageNow li { + float: left; + width: 31%; + } + + #pageNow li:nth-child(3n+1) { + clear: left; + } +} + + +/* + +@media (min-width: 1696px) { + #pageNow li:nth-child(4n+1) { + clear: left; + } +} +@media (max-width: 1695px) { + #pageNow li:nth-child(3n+1) { + clear: left; + } +} + +@media (max-width: 1275px) { + #pageNow li { + width:46%; + } + #pageNow li:nth-child(2n+1) { + c_lear: left; + } +} +@media (max-width: 865px) { + #pageNow li { + width:96%; + } +} +@media (max-width: 420px) { + #pageNow img, #eventDetail .ui-widget-shadow{ + display:none; + } + #pageNow li { + width:310px; + margin-left:0px; + margin-right:0px; + } + #pageNow .desc { + width:220px; + } + #eventDetail { + width:320px; + height:100%; + position:fixed; + } +} +*/ diff --git a/http/src/css/theme/default.less b/http/src/css/theme/default.less new file mode 100644 index 0000000..d55a291 --- /dev/null +++ b/http/src/css/theme/default.less @@ -0,0 +1,7 @@ +@import (inline) "../../../3rdParty/boilerplate5/css/normalize.min.css"; +@import (inline) "../../../3rdParty/boilerplate5/css/main_pre.min.css"; +@import (inline) "../../../3rdParty/jquery-ui-1.11.4.custom/jquery-ui.min.css"; +@import (inline) "../../../3rdParty/jQuery-Timepicker-Addon-master/dist/jquery-ui-timepicker-addon.min.css"; +@import (inline) "../../../3rdParty/fontello/css/epgd.css"; +@import "../epgd.less"; +@import (inline ) "../../../3rdParty/boilerplate5/css/main_post.min.css"; diff --git a/http/src/js/1_main.js b/http/src/js/1_main.js new file mode 100644 index 0000000..3a8251a --- /dev/null +++ b/http/src/js/1_main.js @@ -0,0 +1,714 @@ + +epgd.profile = { + needLogin: -1, + channelLogoPath: "data/channellogo", + eventImgPath: "data/eventimg", + movieMediaPath: "data/moviemedia", + serieImgPath: "data/seriesmedia", + movieActorPath: "http://www.themoviedb.org/person/", + serieSeasonPath: "http://www.thetvdb.com/?tab=seasonall&id=", + constabelEditPath: "https://www.eplists.de/eplist.cgi?action=edit&back=&file=", + constabelLinkPath: "https://www.eplists.de/eplist.cgi?action=show_form_redir&linkname=", + minEventTime: 0, + maxEventTime: 0, + logoShowName: 0 +}; +epgd.userProfile_defaults = { + defaultVDRuuid: '', + constabelLoginPath: false, + pickerFirstDay: '6', + quickTimes: '', + startWithSched: 0, + startPage: "menu_options", + namingModeSerie: "0", + namingModeSearchSerie: "0", + namingModeMovie: "0", + namingModeSearchMovie: "0", + namingModeSerieTemplate: "", + namingModeSearchSerieTemplate: "", + namingModeMovieTemplate: "", + namingModeSearchMovieTemplate: "", + chFormat: "", + timerDefaultVDRuuid: '', + searchAdv: "0", + mailReceiver: "", + messageMailTypes: "", + magazinePan: 10, + magazinePanDelay: 400, + maxListEntries: 100, + ratings: "", + recordSubFolderSort: 1 +}; +epgd.profile_load = function (doNotCache) { + var profile = $.extend(epgd.profile, epgd.userProfile_defaults); + epgd.ajax({ url: epgd.login.url + "data/parameters", async: false, cache: false, dataType: "json" },function (data) { + var p,i,k, + oldVal, now, + changes = {}; + for (i in data.parameters) { + p = data.parameters[i]; + oldVal = profile[p.name]; + if (oldVal != undefined && oldVal != p.value) { + profile[p.name] = p.type === 0 ? parseInt(p.value, 10) : p.value; + changes[p.name] = oldVal; + if (p.name.indexOf('logo') == 0) + epgd.channels.isDirty = true; + } + } + if (epgd.utils.timeOffset == null) {
+ epgd.utils.timeOffset = (data.timezone - new Date().getTimezoneOffset() * 60) * 1000;
+ now = epgd.utils.now();
+ epgd.$dtPicker.datetimepicker('setDate', new Date(now.setMinutes(parseInt(now.getMinutes() / 15, 10) * 15)));
+ } + if (!profile.minEventTime) { + now = epgd.utils.now(); + profile.minEventTime = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0).getTime() / 1000; + changes["minEventTime"] = 0; + } + if (!profile.maxEventTime) { + profile.maxEventTime = profile.minEventTime + 8 * 24 * 60 * 60 - 60; + changes["maxEventTime"] = 0; + } + for (k in changes) { + $(window).trigger("profile_updated", changes); + break; + } + epgd.channels.isDirty && epgd.channels.load(); + }); +} + +epgd.pages = {}; + +epgd.login = { + user: '', + session: '', + rights:-1, + url: '' +} +epgd.rights = { // userMask + umConfig: 2, + umConfigEdit: 4 + 2, + umConfigUsers: 8, + umTimer: 64, + umTimerEdit: 128 + 64, + umSearchTimer: 256 + 64, + umSearchTimerEdit: 512 + 256 + 128 + 64, + umFsk: 4096, + umRecordings: 32768, + umRecordingsEdit: 65536 + 32768 +} +epgd.utils = { + timeOffset: null, + now: function () {return new Date(new Date().getTime() - this.timeOffset);}, + date: function (unixTime) { return new Date(unixTime * 1000 - this.timeOffset); }, + unixTime: function (date) { return date ? parseInt((date.getTime() + this.timeOffset) / 1000, 10) : 0; }, + formatTime: function (unixTime) { + var d = new Date(unixTime * 1000 - this.timeOffset); + return new String(100 + d.getHours()).slice(1) + ':' + new String(100 + d.getMinutes()).slice(1); + }, + formatDateTime: function (unixTime, dateFormat) { + var d = new Date(unixTime * 1000 - this.timeOffset); + return $.datepicker.formatDate((dateFormat || epgd.tr.dateTimePicker.dateFormat), d) + ' ' + new String(100 + d.getHours()).slice(1) + ':' + new String(100 + d.getMinutes()).slice(1); + }, + formatDate: function (unixTime, dateFormat) { + var d = new Date(unixTime * 1000 - this.timeOffset); + return $.datepicker.formatDate((dateFormat || epgd.tr.dateTimePicker.dateFormat), d); + }, + popup: function (txt, options) { + var $w = $(window), + $dlg; + options = $.extend({ + autoOpen: true, + dialogClass: 'popup', + show: { + effect: "blind", + duration: 1000 + }, + hide: { + effect: "explode", + duration: 1000 + }, + width: 400, + height:200, + maxWidth: $w.width() * 0.8, + maxHeight: $w.height() * 0.7,
+ }, options); + $dlg = $('<div class="epgPopUp"><p>' + txt + '</p></div>').dialog(options); + options.autoClose && window.setTimeout(function () { $dlg.dialog('close').dialog('destroy'); }, options.autoClose); + return $dlg; + }, + confirm: function (message, callback) { + var o = { + modal: true, + buttons: {} + }; + o.buttons[epgd.tr.yes]= function () { $(this).dialog('close'); callback(true);}; + o.buttons[epgd.tr.no]= function () { $(this).dialog('close'); callback(false);}; + this.popup(message, o); + }, + topInfo: function (txt, options) { + var isError = options && options.isError, + $info, + dura; + options = $.extend({ + autoClose: isError ? 0 : 3000, + className: "ui-state-" + (isError ? 'error' : 'highlight') + },options); + dura = (options.autoClose || 3000) / 2; + $info = $('<div class="topInfo ui-corner-all ' + options.className + '">' + txt + + '<button onclick="$(this).parent().remove();" class="iAsButton i-cancel" title="' + epgd.tr.close + + '"></button></div>') + .appendTo(epgd.$menu) + .animate({ 'opacity': 0.4 }, dura, function () { $info.animate({ 'opacity': 1 }, dura); }); + options.autoClose && window.setTimeout(function () { $info.remove() }, options.autoClose); + }, + sendMail: function (subject, body, mimetype, receiver) { + epgd.ajax({ + url: epgd.login.url + 'data/sendmail', + type: 'post', + data: JSON.stringify({ "receiver": (receiver || epgd.profile.mailReceiver), "subject": subject, "body": body, "mimetype": mimetype }) + }, function (data) { + data = data.result; + if (data && data.state == 200) + epgd.utils.topInfo(epgd.tr.dataSend); + else + epgd.utils.topInfo(data.message, { isError: 1 }); + epgd.profile_load(); + }); + }, + loader: { + $win: $('<div style="position:absolute;z-index:9999;width:100%;height:100%;position:fixed;left:0px;top:0px;background:url(images/loader.png) no-repeat 50% 50%"></div>'), + cnt: 0, + process: function (actionFunc, doNotRemove) { + var loader = this; + this.cnt++; + this.$win.appendTo(document.body).stop().animate({ opacity: 0.7}, { + always: function () { + try{ + actionFunc(); + } catch (e) { + epgd.utils.log((e.message || 'common error') + '\n' + (e.stack || ''),0); + loader.close(); + } + !doNotRemove && loader.close(); + } + }, 200); + }, + close: function () { + if (this.cnt > 0) { + this.cnt--; + this.cnt == 0 && this.$win.remove(); + } + } + }, + addAutoComplete: function (inputSelector, options) { + var $sel = $(inputSelector), + cn = $sel[0].className, + w = $sel[0].style.width || ""; + $(inputSelector).autocomplete($.extend({ + minLength: 0, + multiselect: false, + create: function (event, ui) { // based on http://jsfiddle.net/mekwall/sgxKJ/ + var inst = $(this).autocomplete('instance'), + o = inst.options, + fontSize, kc; + + inst.selectedItems = {}; + if (o.multiselect) {
+ inst.multiselect = $("<div></div>") + .addClass("ui-autocomplete-multiselect ui-state-default ui-widget " + cn) + .css("width", w) + .insertBefore(inst.element) + .append(inst.element) + .bind("click.autocomplete", function () {
+ inst.element.focus();
+ }); + inst.menu.element.css({ "height": "300px", "overflow-y": "auto" }); + fontSize = parseInt(inst.element.css("fontSize") || 10, 10); + function autoSize(e) { + // Hackish autosizing + var $this = $(this); + $this.width(1).width(this.scrollWidth + fontSize - 1);
+ }; + kc = $.ui.keyCode; + inst.element.bind({
+ "keydown.autocomplete": function (e) {
+ if ((this.value === "") && (e.keyCode == kc.BACKSPACE)) {
+ var prev = inst.element.prev(); + delete inst.selectedItems[prev.text()]; + prev.remove();
+ }
+ }, + // TODO: Implement outline of container + "focus.autocomplete blur.autocomplete": function () {
+ inst.multiselect.toggleClass("ui-state-active");
+ }, + "keypress.autocomplete change.autocomplete focus.autocomplete blur.autocomplete": autoSize
+ }).trigger("change"); + o.select = o.select || function (e, ui) {
+ if (!inst.selectedItems[ui.item.label]) {
+ $("<div></div>") + .addClass("ui-autocomplete-multiselect-item") + .text(ui.item.label) + .append( + $("<span></span>") + .addClass("ui-icon ui-icon-close") + .click(function () {
+ var item = $(this).parent(); + delete inst.selectedItems[item.text()]; + item.remove();
+ }) + ) + .insertBefore(inst.element); + inst.selectedItems[ui.item.label] = ui.item;
+ } + inst._value(""); + return false;
+ }
+ } else {
+ o.select = o.select || function (e, ui) {
+ inst.selectedItems[0] = ui.item;
+ inst._value(ui.item.label);
+ return false;
+ }
+ }; + } + }, options)).focus(function () { + $(this).autocomplete("search", ""); + });/*.bind("keydown", function (event) { + if (event.keyCode === $.ui.keyCode.TAB && + $(this).autocomplete("instance").menu.active) { + event.preventDefault(); + } + });*/ + }, + getAutoCompleteValues: function (inputSelector, quot) { + quot = quot || ''; + var values = '', + del= ',' + quot, + ac,key; + try { + ac = $(inputSelector).autocomplete("instance").selectedItems; + for (key in ac) + values += del + ac[key].value + quot; + } catch (e) { } + return values.slice(1); + }, + setAutoCompleteValues: function (inputSelector, values ) { + var ac = $(inputSelector).autocomplete("instance"), + item,i, + matcher; + ac.multiselect && ac.multiselect.find(">div").remove(); + ac.selectedItems = {}; + if (values) { + for (i = 0; i < values.length; i++) { + item = null; + matcher = new RegExp($.ui.autocomplete.escapeRegex(values[i]), "i"); + $.each(ac.options.source, function () { + if (matcher.test(this.value || this.label || this)) + return !(item = this); + }); + if (item) + ac._trigger("select", null, { item: item.label ? item : {label:item,value:item} }); + } + } + }, + addPlaceholders: function (inputSelector, key, placeholders) {
+ var input = $(inputSelector)[0],
+ html = '<ul class="placeholders ui-menu ui-widget ui-widget-content">',
+ p;
+ for (p in placeholders) + html += '<li class="ui-menu-item"><b>' + p + '</b>' + placeholders[p] + '</li>'; + input.$placeholders = $(html + '</ul>').hide().insertAfter(input).click(function (ev) {
+ var placeholder = ev.target.nodeName == 'B' ? $(ev.target).text() : ev.target.nodeName == 'LI' ? $(ev.target.firstChild).text() : null,
+ cursorPos = $(input).prop('selectionStart'),
+ v = $(input).val();
+ if (placeholder) {
+ $(input).val(v.substring(0, cursorPos) + placeholder + v.substring(cursorPos, v.length)).focus();
+ cursorPos += placeholder.length;
+ if (input.setSelectionRange) {
+ input.setSelectionRange(cursorPos, cursorPos);
+ }
+ else if (input.createTextRange) {
+ v = input.createTextRange();
+ v.collapse(true);
+ v.moveEnd('character', cursorPos);
+ v.moveStart('character', cursorPos);
+ v.select();
+ }
+ }
+ $(this).hide();
+ });
+ $(input).keydown(function (ev) {
+ if (ev.key == key) {
+ $(document).one("click", function () { input.$placeholders.hide(); })
+ input.blur();
+ return !input.$placeholders.show().position({
+ my: "left top",
+ at: "left bottom",
+ of: input
+ });
+ }
+ });
+ }, + inherits : function (childClass, parentClass) { + var tempClass = function () { }; + tempClass.prototype = parentClass.prototype; + childClass.prototype = new tempClass(); + childClass.prototype.constructor = childClass; + childClass.base = parentClass.prototype; + return childClass; + }, + log: function (message, level) { + console.log("error:" + message); + try { + $.ajax({ url: "data/log", type: 'get', async: true, cache: false, data: "level=" + (level || 0) + "&message=" + escape(message) }); + } catch (e) {} + } +}; + +epgd.init = function () { + + epgd.$con = $('<div id="content"></div>').appendTo(document.body); + + $.datepicker.setDefaults(epgd.tr.dateTimePicker); + $.datepicker.setDefaults({ + showOtherMonths: true, + selectOtherMonths: true, + }); + $.timepicker.setDefaults(epgd.tr.dateTimePicker); + $.timepicker.setDefaults({ + timeInput: true, + controlType: { + create: function (tp_inst, obj, unit, val, min, max, step) { + if (unit == 'hour') { + if (!tp_inst.inst.settings.timeOnly) + $('#ui-datepicker-div').width(($(window).width() > 500 ? 430 : 230)+ "px"); + $('<span><u>0</u><u>2</u><u>4</u><u>6</u><u>8</u><u>10</u><br /><u>12</u><u>14</u><u>16</u><u>18</u><u>20</u><u>22</u><span>') + .appendTo(obj).bind("click", { tp_inst: tp_inst, obj: obj, unit:unit }, $.timepicker.quicklink); + } else if (unit == 'minute') { + $('<span><u>0</u><u>15</u><u>30</u><u>45</u><span>') + .appendTo(obj).bind("click", { tp_inst: tp_inst, obj: obj, unit:unit }, $.timepicker.quicklink); + } else if (unit == 'second' && epgd.profile.quickTimes) { + obj.closest('dl').find('.ui_tpicker_time').removeClass() + .bind("click", { tp_inst: tp_inst, obj:obj, unit: 'time' }, $.timepicker.quicklink).html('<i><u title="' + epgd.profile.quickTimes.replace(/[^=~]+=@[a-z]+/gi, '').replace(/~{2,}/g, '~').replace(/=!?/g, '">').replace(/~/g, '</u></i><i><u title="') + '</u></i>'); + if (tp_inst.inst.settings.alwaysSetTime)
+ epgd.pages.help.initButtons(tp_inst.inst.dpDiv.find('.ui-datepicker-buttonpane').append(epgd.pages.help.getButton('datepicker'))); + else
+ $('<button class="iAsButton i-cancel" role="button">' + epgd.tr.clear + '</button>').appendTo(tp_inst.inst.dpDiv.find('.ui-datepicker-buttonpane')).click(function () {
+ tp_inst.$input.val(''); + $.datepicker._hideDatepicker();
+ }); + return obj; + } else + return obj; + + $('<input class="ui-timepicker-input" value="' + val + '" style="width:20px">') + .prependTo(obj) + .spinner({ + min: min, + max: max, + step: step, + change: function (e, ui) { // key events + // don't call if api was used and not key press + if (e.originalEvent !== undefined) + tp_inst._onTimeChange(); + tp_inst._onSelectHandler(); + }, + spin: function (e, ui) { // spin events + tp_inst.control.value(tp_inst, obj, unit, ui.value); + tp_inst._onTimeChange(); + tp_inst._onSelectHandler(); + } + }); + return obj; + }, + options: function (tp_inst, obj, unit, opts, val) { + if (typeof (opts) == 'string' && val !== undefined) + return obj.find('.ui-timepicker-input').spinner(opts, val); + return obj.find('.ui-timepicker-input').spinner(opts); + }, + value: function (tp_inst, obj, unit, val) { + try { + if (val !== undefined) + return obj.find('.ui-timepicker-input').spinner('value', val); + return obj.find('.ui-timepicker-input').spinner('value'); + } catch (e) { + return false; + } + } + } + }); + + + epgd.$menu = $('<nav id="menu-top"><ul id="ui-menu-top"><li id="menu_login"><a href="#menu_login">' + epgd.tr.pages.login.label + '</a></li></ul></nav>').appendTo(document.body).find('ul').hide(); + epgd.$menu.$maxBut = $('<span class="maxi i-menu" />').insertBefore(epgd.$menu).click(function () { + epgd.$menu.parent().toggleClass('open'); + }); + epgd.$menu.checkMenuSize = function (ev, callback) { + if (window.wrm_i) { // interval aktiv?
+ if (window.wrm_w == $(window).width()) { //Breite vom vorherigen Aufruf und aktuelle Breite gleich?
+ window.clearInterval(window.wrm_i);
+ delete window.wrm_i;
+ epgd.$menu.parent().removeClass('mini').width(window.wrm_w).offset({ 'left': $(window).scrollLeft() });
+ epgd.$menu.checkMenuSize(null, callback);
+ } else
+ window.wrm_w = $(window).width();
+ return;
+ }
+ if (ev) {
+ window.wrm_w = $(window).width();
+ if (!window.wrm_i) // Interval setzen, um sicher zu sein, dass die Breite jetzt stimmt
+ window.wrm_i = window.setInterval(epgd.$menu.checkMenuSize, 200,null,callback);
+ } else {
+ if (epgd.$menu.height() > 40)
+ epgd.$menu.parent().addClass('mini');
+ window.setTimeout(function () {
+ document.body.style.paddingTop = (epgd.$menu.parent().height() + 10) + "px";
+ callback && window.setTimeout(callback,200);
+ }, 200);
+ } + }; + //epgd.$menu.show().checkMenuSize(); + $(window).bind("resize", epgd.$menu.checkMenuSize); + epgd.$dtPicker = $('<input type="text" id="selDate" readonly style="z-index:199;position:relative" />').appendTo(document.body).hide().bind("click",function () { $(this).datepicker("show"); return false; }); + epgd.$dtPicker.datetimepicker({
+ beforeShow: function () {
+ this.$overlay = $("<div />").addClass("ui-widget-overlay ui-front").appendTo(document.body);
+ }, + onClose: function () {
+ this.$overlay.remove(); + $(window).trigger('datepicker');
+ },
+ calendarStart: function() { + var d= new Date(epgd.profile.minEventTime * 1000) + leadDays = (d.getDay() - parseInt(epgd.profile.pickerFirstDay, 10) + 7) % 7; + d.setHours(12, 0); + d.setDate(d.getDate() - leadDays); + return d; + }
+ }); + + epgd.$menu.menu({ + position: { at: "left bottom" }, + select: function (event, ui) { + var id = ui.item.attr('id'); + if (!id || id.indexOf('menu_') != 0 || (event.originalEvent && event.originalEvent.target.nodeName != 'A' && event.originalEvent.target.nodeName != 'LI')) + return false; + $(window).trigger("epgd_close"); + epgd.$menu.parent().removeClass('open'); + $(".menu-active", this).removeClass("menu-active"); + $(document.body).append(epgd.$dtPicker.hide()); + epgd.$menu.checkMenuSize(null,function () {
+ try {
+ ui.item.addClass("menu-active").parent().parent('.ui-menu-item').addClass("menu-active"); + epgd.pages[id.slice(5)].render();
+ } catch (e) {
+ epgd.utils.popup(epgd.tr.error.common, { title: epgd.tr.error.error });
+ epgd.utils.log((e.message || 'common error') + '\n' + (e.stack || ''), 2);
+ }
+ }); + } + }); + $(window).bind("epgd_close", function () { + $('.epgPopUp').dialog('destroy'); + }).bind("profile_updated", function (e,changes) { + if (changes["minEventTime"] != undefined) + epgd.$dtPicker.datetimepicker("option", {"minDateTime": new Date((epgd.profile.minEventTime= parseInt(epgd.profile.minEventTime,10)) * 1000), "minDate": new Date(epgd.profile.minEventTime * 1000)}); + if (changes["maxEventTime"] != undefined) + epgd.$dtPicker.datetimepicker("option", {"maxDateTime": new Date((epgd.profile.maxEventTime= parseInt(epgd.profile.maxEventTime,10)) * 1000), "maxDate": new Date(epgd.profile.maxEventTime * 1000)}); + if (changes["pickerFirstDay"] != undefined) + epgd.$dtPicker.datetimepicker("option", { "firstDay": epgd.profile.pickerFirstDay }); + if (changes["defaultVDRuuid"] != undefined) { + $('#menu_vdrs > select').val(epgd.profile.defaultVDRuuid); + } + if (changes["quickTimes"] != undefined) {
+ epgd.pages.magazine.initQT();
+ } + if (changes["needLogin"] != undefined) { + epgd.pages.login.doLogin(); + } + }).bind("login_changed", function (e, oldLogin) { + epgd.$menu.html('').hide(); + epgd.$con.html(''); + if (epgd.login.rights) { + epgd.$menu.append('<li id="menu_now"><a href="#menu_now">' + epgd.tr.menu.now + '</a></li>'); + epgd.$menu.append('<li id="menu_magazine"><a href="#menu_magazine">' + epgd.tr.menu.magazine + '</a></li>'); + (epgd.login.rights & epgd.rights.umTimer) == epgd.rights.umTimer && epgd.$menu.append('<li><a>' + epgd.tr.menu.timer + '</a><ul>' + + '<li id="menu_timerList"><a href="#menu_timerList">' + epgd.tr.pages.timer.timerList + '</a></li>' + + ((epgd.login.rights & epgd.rights.umSearchTimer) == epgd.rights.umSearchTimer ? '<li id="menu_searchTimerList"><a href="#menu_searchTimerList">' + epgd.tr.pages.timer.searchTimerList + '</a></li>' : '') + + '<li id="menu_timersDone"><a href="#menu_timersDone">' + epgd.tr.pages.timer.timersDone + '</a></li>' + + '<li id="menu_timerListDone"><a href="#menu_timerListDone">' + epgd.tr.pages.timer.timerListDone + '</a></li>' + + '<li id="menu_timerJobList"><a href="#menu_timerJobList">' + epgd.tr.pages.timer.timerJobList + '</a></li>' + + '<li id="menu_messageList"><a href="#menu_messageList">' + epgd.tr.pages.timer.messageList + '</a></li>' + + '</ul></li>'); + (epgd.login.rights & epgd.rights.umRecordings) == epgd.rights.umRecordings && epgd.$menu.append('<li id="menu_records"><a href="#menu_records">' + epgd.tr.menu.records + '</a></li>'); + epgd.$menu.append('<li id="menu_search"><a href="#menu_search">' + epgd.tr.menu.search + '</a></li>'); + epgd.$menu.append('<li><a>' + epgd.tr.menu.options + '</a><ul>' + + '<li id="menu_profile"><a href="#menu_profile">' + epgd.tr.pages.options.profile + '</a></li>' + + ((epgd.login.rights & epgd.rights.umConfigEdit) == epgd.rights.umConfigEdit ? '<li id="menu_editChannels"><a href="#menu_editChannels">' + epgd.tr.pages.options.editChannels + '</a></li>' : '') + + ((epgd.login.rights & epgd.rights.umConfigUsers) == epgd.rights.umConfigUsers ? '<li id="menu_editUser"><a href="#menu_editUser">' + epgd.tr.pages.options.editUser + '</a></li>' : '') + + '</ul></li>'); + epgd.$menu.append('<li id="menu_help"><a href="#menu_help">' + epgd.tr.menu.help + '</a></li>'); + epgd.$menu.append('<li id="menu_vdrs"><a href="#menu_vdrs">VDR</a><select></select></li>'); + } + epgd.profile.needLogin == "1" && epgd.$menu.append('<li id="menu_login"><a href="#menu_login">' + + (epgd.login.session ? epgd.login.user + ' ' + epgd.tr.pages.login.logout : epgd.tr.pages.login.label ) + + '</a></li>'); + if (epgd.login.user != oldLogin.user) { + epgd.profile_load(); + epgd.channels.isDirty = true; + epgd.vdrs.list = null; + } + epgd.channels.load(); + epgd.vdrs.load(); + epgd.$menu.show().menu("refresh"); + epgd.$menu.menu("select", { target: $(epgd.login.rights ? (location.hash || '#' + epgd.profile.startPage || '#menu_profile') : '#menu_login') });//.concat('=' + epgd.profile.startPage + '=').match(/(menu_[^=]+)/)[1] }); + + }).bind("vdrs_load", function () { + html = ''; + for (var uuid in epgd.vdrs.list) { + html += '<option value="' + uuid + '"' + (uuid == epgd.vdrs.current.uuid ? 'selected' : '') + '>' + epgd.vdrs.list[uuid].name + '</option>'; + } + $('<select>' + html + '</select>').replaceAll('#menu_vdrs > select').show().change(function () { + epgd.vdrs.current = epgd.vdrs.get(this[this.selectedIndex].value); + }).mousedown(function (ev) { + ev.stopPropagation(); + return true; + }).click(function (ev) { + return false; + }); + }).bind("unload", function () { + if (epgd.login.session) + epgd.pages.login.doLogin('logout'); + }); + + epgd.pages.now.init(); + epgd.pages.magazine.init(); + epgd.profile_load(); + if (epgd.profile.needLogin == -1) { + epgd.profile.needLogin = 0; + epgd.pages.login.doLogin(); + } + window.setInterval(epgd.profile_load, 3600000); // ca. jede Stunde neu abfragen + // window.setTimeout(function () { $(window).trigger('resize'); }); +} +window.onerror = function (msg, url, line, col, error) {
+ // Note that col & error are new to the HTML 5 spec and may not be
+ // supported in every browser. It worked for me in Chrome.
+ var extra = !col ? '' : '\ncolumn: ' + col;
+ extra += !error ? '' : '\nerror: ' + error.stack;
+ try{
+ epgd.utils.log(msg + "\nline: " + line + extra, 2);
+ } catch(e){}
+ return true;
+}; + +$.widget("custom.catcomplete", $.ui.autocomplete, { + _create: function () { + this._super(); + this.widget().menu("option", "items", "> :not(.ui-autocomplete-category)"); + }, + _renderMenu: function (ul, items) { + var that = this, + currentCategory = ""; + $.each(items, function (index, item) { + var li; + if (item.category != currentCategory) { + ul.append("<li class='ui-autocomplete-category'>" + item.category + "</li>"); + currentCategory = item.category; + } + li = that._renderItemData(ul, item); + if (item.category) { + li.attr("aria-label", item.category + " : " + item.label); + } + }); + } +}); +$.datepicker._gotoToday = function (id) {
+ var inst = this._getInst($(id)[0]), + now = epgd.utils.now(); + this._base_gotoToday(id); + this._setTime(inst, now); + this._setDate(inst, now);
+ this._hideDatepicker();
+}; +$.timepicker.quicklink = function (ev) {
+ var target = ev.target.nodeName == 'I' ? ev.target.firstChild : ev.target, + tp_inst, + val = null, + d = false; + try {
+ tp_inst = ev.data.tp_inst || $.datepicker._getInst(epgd.$dtPicker[0]).settings.timepicker;
+ } catch (e) {
+ epgd.utils.log((e.message || 'common error') + '\n' + (e.stack || ''), 2);
+ return false;
+ } + if (target.nodeName == 'U') {
+ if (ev.data.unit == "time")
+ val = $.datepicker.parseTime(tp_inst._defaults.timeFormat, target.innerHTML, tp_inst._defaults);
+ else if (ev.data.unit == "hour")
+ val = { hour: parseInt(target.innerHTML, 10), minute: tp_inst.minute };
+
+ if (val) {
+ if (val.hour < tp_inst.hour - 1) + d = true;
+ else {
+ tp_inst.control.value(tp_inst, tp_inst.hour_slider, "hour", val.hour); + tp_inst._onTimeChange(); + if (tp_inst.hour != val.hour) + d = true;
+ } + if (d) {
+ d = new Date(tp_inst.inst.selectedYear, tp_inst.inst.selectedMonth, tp_inst.inst.selectedDay + 1, val.hour, val.minute); + $.datepicker._setDate(tp_inst.inst, d); + $.datepicker._setTime(tp_inst.inst, d); + $.datepicker._updateDatepicker(tp_inst.inst);
+ } else + tp_inst.control.value(tp_inst, tp_inst.minute_slider, "minute", val.minute);
+ } else + tp_inst.control.value(tp_inst, ev.data.obj, ev.data.unit, parseInt(target.innerHTML, 10)); + tp_inst._onTimeChange(); + tp_inst._onSelectHandler(); + if (ev.target.nodeName == 'I') + $.datepicker._hideDatepicker();
+ }
+} + +epgd.ajax = function (options, success, error) { + var settings = $.extend({ dataType: 'json', contentType: "application/json; charset=utf-8" }, options); + return $.ajax(settings).fail(function (jqxhr, e) { + epgd.utils.loader.close(); + if (jqxhr.status == 401) { + epgd.pages.login.doLogin(null,null,function () { + if (epgd.login.rights) { + settings.url = settings.url.replace(/sid[^\/]+\//, epgd.login.url); + $.ajax(settings).done(success).fail(function () { + epgd.utils.popup(epgd.tr.error.forbidden, { title: epgd.tr.error.error }); + }); + } else + epgd.utils.popup(epgd.tr.error.forbidden, { title: epgd.tr.error.error }); + }); + } + else if (jqxhr.status == 403) { + epgd.utils.popup(epgd.tr.error.forbidden, { title: epgd.tr.error.error }); + } else if (jqxhr.status == 501){
+ epgd.utils.popup(epgd.tr.error.notImplemented, { title: epgd.tr.error.error });
+ } else { + if (error && error.call(this, jqxhr, e)) + return; + //if (jqxhr.status == 409) { + var mess = ''; + try {
+ if (jqxhr.responseJSON) + mess = jqxhr.responseJSON.result.message;
+ } catch (e) {
+ mess = ''; + epgd.utils.log((e.message || 'common error') + '\n' + (e.stack || '') + '\n options:' + JSON.stringify(options) + '\n jqhr:' + JSON.stringify(jqxhr), 3);
+ } + epgd.utils.popup(mess || jqxhr.responseText || epgd.tr.error.serverNotResponse, { title: epgd.tr.error.error }); +// } else + //epgd.utils.popup(epgd.tr.error.serverNotResponse, { title: epgd.tr.error.error }); + } + }).done(success); +}; diff --git a/http/src/js/5_timerDialog.js b/http/src/js/5_timerDialog.js new file mode 100644 index 0000000..704f31e --- /dev/null +++ b/http/src/js/5_timerDialog.js @@ -0,0 +1,640 @@ +// Timer Dialoge - Basis Klasse +epgd.timerDialogBase = function (options) {
+ this.$win = null;
+ this.list = null;
+ if ( options )
+ this.options= $.extend({}, this.options, options);
+} +epgd.timerDialogBase.prototype = {
+ options: {
+ id: "baseDialog", + modal: true, + draggable: true, + resizable: true, + autoOpen: false, + width: 'auto', + maxHeight: $(window).height(), + close: function () {
+ this.list.dialog.form.reset(); + $(this.list.dialog.form).next().remove(); + //allFields.removeClass("ui-state-error"); + },
+ buttons: [{
+ text: epgd.tr.del, + icons: { primary: "ui-icon-trash" }, + id: 'tBDel', + click: function () {
+ $(this).dialog("close"); + this.list.del(this.list.dialog.form.tID.value);
+ }
+ }, {
+ text: epgd.tr.cancel, + icons: { primary: "ui-icon-close" }, + click: function () {
+ $(this).dialog("close");
+ }
+ }, {
+ text: epgd.tr.save, + icons: { primary: "ui-icon-disk" }, + click: function () { this.list.dialog.save() }
+ }]
+ }, + save: function (data, url, failFunc, succFunc) { + this.list.save(data || this.getData(), url, failFunc, succFunc) && !this.options.embed && this.$win.dialog("close"); + }, + showError: function (msg, field) {
+ epgd.utils.popup((field && field.id ? '<b>' + $('label[for="' + field.id + '"]').text() + '</b>' : '') + '<div>' + msg + '</div>', { autoClose: 3000 }); + field && field.focus(); + return false;
+ },
+ loadFolder: function () {
+ var dialog = this; + epgd.ajax({ url: epgd.login.url + "data/recordingdirs" }, function (data) {
+ if (data.recordingdirs.length) {
+ var folder = [], + vdrs = epgd.vdrs.list, + vdr; + $.each(data.recordingdirs, function (id, f) {
+ vdr = vdrs[f.vdruuid]; + folder.push({ value: f.directory, category: vdr ? vdr.name : '-' });
+ }); + $(dialog.form.tFolder).catcomplete("option", "source", folder);
+ }
+ });
+ },
+ close: function () {
+ if (this.$win) + this.$win.dialog("close");
+ },
+ create: function () {
+ var o = this.options, + tr = epgd.tr.pages.timerList, + week = '', + i; + for (i = 1; i < epgd.tr.dateTimePicker.dayNamesShort.length; i++) + week += '<input name="tWeek" type="checkbox" />' + epgd.tr.dateTimePicker.dayNamesShort[i]; + week += '<input name="tWeek" type="checkbox" />' + epgd.tr.dateTimePicker.dayNamesShort[0]; + this.$win = $('<div id="' + o.id + '" class="searchDialog"><form>' + + '<div class="colBlock">' + + '<div><label> </label><select id="tType"><option value="R">' + epgd.tr.pages.eventDetail.record + '</option><option value="V">' + epgd.tr.pages.eventDetail.ch_switch + '</option></select></div>' + + '<div><label for="tSName">' + epgd.tr.pages.search.searchName + '</label><input type="text" id="tSName" /></div>' + +'<div><label for="tInactive">' + tr.inactive + '</label><input type="checkbox" id="tInactive" /></div>' + + '</div><div class="ui-corner-all week">' + week + '</div>' + + '<div class="onlyTypeR"><label for="tNameMode">' + tr.namingMode + epgd.pages.help.getIcon('sTNameMode') + '</label><br /><select id="tNameMode"><option>' + tr.namingModes.join('</option><option>') + '</option></select></div>' + + '<div class="onlyTypeR"><label for="tTemplate">' + tr.template + '</label><input class="full" id="tTemplate" type="text" value="" /></div>' + + '<div class="onlyTypeR"><label for="tFolder">' + tr.folder + '</label><input class="full" type="text" id="tFolder" /></div>' + + '<div class="colBlock">' + + '<div class="noTypeS"><label for="tVdr">VDR</label><select id="tVdr"><option value="">Auto</option>' + $('#menu_vdrs').find('select').html() + '</select></div>' + + '<div class="onlyTypeR"><label for="tPrio">' + tr.prio + '</label><input type="number" placeholder="..." min="0" max="99" id="tPrio" style="width:40px" /></div>' + + '<div class="onlyTypeR"><label for="tLife">' + tr.lifetime + '</label><input type="number" placeholder="..." min="0" max="99" style="width:40px" id="tLife"/></div>' + + '<div class="onlyTypeR"><label for="tVPS">' + 'VPS' + '</label><input type="checkbox" id="tVPS" /></div>' + + '</div>' + + '<input type="hidden" id="tID" /><br clear="all" />' + + '</form></div>');//.dialog(o);//.dialog("option", "buttons", o.buttons); + !o.embed && this.$win.appendTo(document.body).dialog(o); + this.$win[0].list = this.list; + this.form = this.$win.find('form')[0]; + $(this.form.tFolder).catcomplete({
+ minLength: 0, + maxHeight: 300
+ }).focus(function () {
+ $(this).catcomplete("search", "");
+ }); + $(this.form.tType).change(function () {
+ if (this.selectedIndex < 0) + this.selectedIndex = 0;
+ this.form.className = this.form.className.replace(/ ?type./, '') + ' type' + this[this.selectedIndex].value;
+ // $('.onlyTypeR', this.form).toggle(this[this.selectedIndex].value == 'R');
+ // $('#tSName').parent().toggle(this[this.selectedIndex].value == 'S');
+ // $('#tRepeat,#tChFormat').parent().toggle(this[this.selectedIndex].value != 'S');
+ }); + $(this.form.tNameMode).change(function () {
+ this.form.tTemplate.parentNode.style.display = (this.selectedIndex == 6) ? 'block': 'none';
+ }); + epgd.utils.addPlaceholders(this.form.tTemplate, '%', tr.templateFields); + this.loadFolder();
+ },
+ render : function (t) {
+ t = t || {}; + if (!this.$win) + this.create(); + !this.options.embed && this.$win.dialog('open').dialog('moveToTop'); + var form = this.form, + d, i; + form.tSName.focus(); + if (t.id) {
+ form.tID.value = t.id; + this.$win.parent().find('#tBDel').show(); + this.$win.parent().find('#tBToggle').hide();
+ } else {
+ form.tID.value = ''; + this.$win.parent().find('#tBDel').hide(); + this.$win.parent().find('#tBToggle').show();
+ } + $(form.tType).val(t.type || 'R').change(); + $(form.tVdr).val(t.vdruuid || epgd.profile.timerDefaultVDRuuid); + d = t.weekdays || 0; + for (i = 0, f = 1; i < form.tWeek.length; i++, f *= 2) + form.tWeek[i].checked = (d & f); + form.tPrio.value = t.priority || ''; + form.tLife.value = t.lifetime || ''; + form.tVPS.checked = t.vps == 1; + form.tInactive.checked = t.active === 0; + form.tFolder.value = t.directory || ''; + form.tSName.value = t.name || '';
+ epgd.pages.help.initButtons(this.$win);
+ this.resize();
+ },
+ resize: function () {
+ /*var dlgOpt = this.$win.dialog("instance").options;
+ dlgOpt.position.my = "center top";
+ dlgOpt.position.at = "center top"; */
+ this.$win.dialog("option", "maxHeight", $(window).height());
+ } + };
+ +// Timerdialog - Klasse +epgd.timerDialog = epgd.utils.inherits(function () {
+ epgd.timerDialogBase.call(this,{
+ id: 'timerDialog', + title: epgd.tr.pages.timer.timerList + ' ' + epgd.tr.edit, + buttons: [{
+ text: epgd.tr.pages.timer.searchTimerList, + icons: { primary: "ui-icon-transferthick-e-w" }, + id: "tBToggle", + click: function () {
+ var t = this.list.dialog.getData(true); + if (t) {
+ $(this).dialog("close"); + //t.channelid && (t.channelids = t.channelid); + if (t.title) {
+ t.expression = t.title;
+ t.searchfields = 1;
+ } + epgd.pages.searchTimerList.dialog.render(t);
+ }
+ }
+ }].concat(epgd.timerDialog.base.options.buttons)
+ });
+}, epgd.timerDialogBase); +epgd.timerDialog.prototype.create = function () {
+ epgd.timerDialog.base.create.call(this); + + var tr = epgd.tr.pages.timerList, + form = this.form; + + $(form).prepend('<input type="hidden" id="tEvID" /><div id="tTitle"></div>'); + $(form.tWeek[0]).parent().before('<div><label for="tStart">' + tr.recordTime + '</label>' + + '<br /><span id="tEvTime"></span> <input type="text" id="tStart" style="width:165px" /> - <input type="text" id="tEnd" style="width:40px" /></div>'); + $(form.tNameMode).after(' <span id="tFile"></span>'); + $(form.tFolder).parent().after('<div><label for="tChannels">' + epgd.tr.channel + + '</label><input id="tChannel" type="text" class="full"/></div>'); + $(this.form.tStart).datetimepicker({
+ minDateTime: epgd.utils.now(),
+ }); + $(this.form.tEnd).timepicker({ + // minDateTime: epgd.utils.now() + }); + epgd.utils.addAutoComplete(form.tChannel, { source: epgd.channels.autoCompleteData }); + form.tFile = $(form).find('#tFile')[0]; + form.tEvTime = $(form).find('#tEvTime')[0]; + form.tTitle = $(form).find('#tTitle').click(function () {
+ if (form.tEvID.value) {
+ epgd.utils.loader.process(function () {
+ new epgd.eventDetail(form.tEvID.value).render();
+ });
+ }
+ })[0];
+}; +epgd.timerDialog.prototype.render = function (t) {
+ t = t || {}; + epgd.timerDialog.base.render.call(this, t); + var form = this.form, + d; + + form.tFile.innerHTML = t.file || '...'; + form.tEvID.value = t.eventid || ''; + epgd.utils.setAutoCompleteValues(form.tChannel, t.channelid ? [t.channelid] : null); + form.tTitle.innerHTML = t.title || ''; + form.tEvTime.innerHTML = t.evStartTime ? epgd.utils.formatDateTime(t.evStartTime) + ' - ' + epgd.utils.formatTime(t.evStartTime + t.evDuration) : ''; + + $([form.tStart, form.tEnd]).datetimepicker("option", "disabled", !!t.eventid); + if (t.day || !t.evStartTime) {
+ if (t.starttime) + d = epgd.utils.date((t.day + parseInt(t.starttime / 100, 10) * 60 * 60 + (t.starttime % 100) * 60)); + else if (t.day) + d = epgd.utils.date(t.day); + else + d = epgd.utils.now(); + $(form.tStart).datetimepicker('setDate', d); + $(form.tStart).datetimepicker('setTime', d); + if (t.endtime) + d = epgd.utils.date((t.day + parseInt(t.endtime / 100, 10) * 60 * 60 + (t.endtime % 100) * 60)); + else + d = new Date(d.getTime() + 2 * 60 * 60000); + $(form.tEnd).datetimepicker('setTime', d);
+ } else {
+ $([form.tStart, form.tEnd]).val('...');
+ } + //form.tNameMode.defaultIndex = parseInt(t.category == 'Serie' ? epgd.profile.namingModeSerie : epgd.profile.namingModeMovie, 10); + form.tNameMode.selectedIndex = typeof t.namingmode == "undefined" ? parseInt(t.category == 'Serie' ? epgd.profile.namingModeSerie : epgd.profile.namingModeMovie, 10) : t.namingmode;
+ form.tTemplate.value = t.template || (t.category == 'Serie' ? epgd.profile.namingModeSerieTemplate : epgd.profile.namingModeMovieTemplate);
+ $(form.tNameMode).change();
+}; +epgd.timerDialog.prototype.getData = function (dontValid) {
+ var form = this.form, + d, i, + data = {}; + if (form.tEvID.value) data.eventid = parseInt(form.tEvID.value, 10); + data.active = form.tInactive.checked ? 0 : 1; + if (form.tID.value) data.id = parseInt(form.tID.value, 10); + if (form.tStart.value && form.tStart.value != '...') {
+ d = $(form.tStart).datepicker('getDate'); + data.starttime = d.getHours() * 100 + d.getMinutes(); + d.setHours(0); + d.setMinutes(0); + data.day = parseInt(d.getTime() / 1000, 10); + data.endtime = parseInt(form.tEnd.value.replace(':', ''), 10);
+ } else if (!data.eventid && !dontValid) + return this.showError(epgd.tr.error.emptyField.replace("$field$", epgd.tr.pages.timerList.recordTime), form.tStart); + data.weekdays = 0; + for (i = 0, f = 1; i < form.tWeek.length; i++, f *= 2) + if (form.tWeek[i].checked) + data.weekdays += f; + data.vps = form.tVPS.checked ? 1 : 0; + if (form.tPrio.value) data.priority = parseInt(form.tPrio.value, 10); + if (form.tLife.value) data.lifetime = parseInt(form.tLife.value, 10); + //if (form.t) data.childlock = form.t; + data.channelid = epgd.utils.getAutoCompleteValues(form.tChannel); + if (!data.channelid && !dontValid) + return this.showError(epgd.tr.error.emptyField.replace("$field$", epgd.tr.channel), form.tChannel); + /*data.file = form.tFile.value; + if (form.tFolder.value) + data.file = form.tFolder.value + '~' + data.file; + */ + d = $(form.tVdr).val(); + if (d) data.vdruuid = d; + //if (!dontValid || form.tNameMode.defaultIndex != form.tNameMode.selectedIndex) + data.namingmode = form.tNameMode.selectedIndex; + data.template = form.tTemplate.value; + data.type = $(form.tType).val(); + if (data.type == 'V' && !d && !dontValid) + return this.showError(epgd.tr.error.emptyField.replace("$field$", "VDR"), form.tVdr); + data.directory = form.tFolder.value; + data.title = form.tTitle.innerHTML || ''; + data.name = form.tSName.value; + return data;
+} +// Suchtimerdialog - Klasse +epgd.searchTimerDialog = epgd.utils.inherits(function (options) { + this.searchResultList = null; + epgd.timerDialogBase.call(this,$.extend({},{
+ id: 'searchTimerDialog', + width: 530, + title: epgd.tr.pages.timer.searchTimerList + ' ' + epgd.tr.edit, + buttons: [{
+ text: epgd.tr.pages.timer.timerList, + icons: { primary: "ui-icon-transferthick-e-w" }, + id: "tBToggle", + click: function () {
+ var t = this.list.dialog.getData(true); + if (t) {
+ $(this).dialog("close"); + t.channelids && (t.channelid = t.channelids.split(',')[0]); + t.expression && (t.title = t.expression); + epgd.pages.timerList.dialog.render(t);
+ }
+ }
+ }, {
+ text: epgd.tr.test, + click: function () {
+ this.list.dialog.search();
+ }
+ }].concat(epgd.searchTimerDialog.base.options.buttons, {
+ text: epgd.tr.copy, + icons: { primary: "ui-icon-copy" }, + id: "tBCopy", + click: function (ev) {
+ $(ev.currentTarget).hide();
+ this.list.dialog.form.tID.value = '';
+ this.list.dialog.form.tSName.value += ' copy';
+ this.list.dialog.form.tSName.select();
+ }
+ })
+ },options)); +}, epgd.timerDialogBase); +epgd.searchTimerDialog.prototype.search = function ($con, searchData) {
+ if (!this.searchResultList)
+ this.searchResultList = new epgd.searchResultList(null);//,this);
+ if (!this.searchResultList.$con || ($con && $con[0] != this.searchResultList.$con[0]))
+ this.searchResultList.render($con || ($('<div style="border-top:1px solid #ccc"></div>').insertAfter(this.form)));
+ else
+ this.searchResultList.$con.find('tbody').empty();
+ if (!this.searchResultList.$con.parent().length) {
+ this.searchResultList.$con.insertAfter(this.form);
+ this.searchResultList.init();
+ }
+ this.searchResultList.update(searchData || this.getData());
+ this.searchResultList.$con[0].scrollIntoView(true);
+} +epgd.searchTimerDialog.prototype.create = function () {
+ epgd.searchTimerDialog.base.create.call(this); + + var tr = epgd.tr.pages.timerList, + trS = epgd.tr.pages.search, + sModes = '', + form = this.form, + key; + + for (key in trS.searchModes) + sModes += '<option value="' + (parseInt(key, 10) + 1) + '">' + trS.searchModes[key] + '</option>'; + if (!epgd.categories) {
+ epgd.categories = []; + epgd.ajax({ url: 'data/categories', async: false }, function (data) { epgd.categories = data.categories; });
+ } + if (!epgd.genres) {
+ epgd.genres = []; + epgd.ajax({ url: 'data/genres', async: false }, function (data) { epgd.genres = data.genres; });
+ } + + $(form.tSName).parent().parent().after('<div><label for="tExpr">' + trS.searchExpression + epgd.pages.help.getIcon('sExpr') + '</label> <input type="text" id="tExpr" style="width:300px" /></div>' + + '<div class="full"><select id="tSMode" style="width:auto">' + sModes + '</select>' + + ' <input type="checkbox" id="tCaseSens" /> <label for="tCaseSens">' + + trS.caseSensitive + '</label></div>' + + '<div class="ui-corner-all week">' + [""].concat(trS.searchFields).join('<input type="checkbox" name="tSFields" />') + '</div>' + + '<div><label for="tAdv"><input type="checkbox" id="tAdv" /> ' + epgd.tr.advanced + epgd.pages.help.getIcon('sTAdv') + '</label><div class="ui-corner-all week">' + + '<span>' + tr.episode + '</span><input type="text" id="tSFEpisode" style="width:200px" /> ' + + '<span>' + epgd.tr.pages.eventDetail.season + '</span><input type="text" id="tSFSeason" style="width:40px" /> ' + + '<span>' + epgd.tr.pages.eventDetail.part + '</span><input type="text" id="tSFSPart" style="width:40px" /> ' + + '<br /><span>' + epgd.tr.pages.eventDetail.category + '</span><input type="text" id="tSFCat" style="width:300px" /> ' + + '<br /><span>' + epgd.tr.pages.eventDetail.genre + '</span><input type="text" id="tSFGenre" style="width:300px" /> ' + + '<br /><input type="checkbox" name="tSFTip" value="GoldTipp" />GoldTipp<input type="checkbox" name="tSFTip" value="TagesTipp" />TagesTipp<input type="checkbox" name="tSFTip" value="TopTipp" />TopTipp' + + '<br /><span>' + epgd.tr.pages.eventDetail.year + '</span><input type="text" id="tSFYear" style="width:70px" />' + + '<br /><input type="checkbox" id="tSFNoEpgMatch" />' + tr.noEpgMatch + + '</div></div>' + + '<div class="noTypeS"><div><label for="tRepeat"><input type="checkbox" id="tRepeat" /> ' + + tr.noRepeat + epgd.pages.help.getIcon('sTRepeat') + '</label><div class="ui-corner-all week">' + [""].concat(trS.searchFields).join('<input type="checkbox" name="tRFields" />') + '</div></div></div>' + + '<div><input type="radio" name="tChExclude" value="1" id="tChExclude0" /><label for="tChInclude">' + tr.chInclude + + '</label>' + epgd.pages.help.getIcon('sTChannels') + '<input type="radio" name="tChExclude" value="0" id="tChExclude1" /><label for="tChExclude">' + tr.chExclude + + '</label></div><input type="text" id="tChannels" class="full"/>' + + '<div class="noTypeS"><label for="tChFormat">' + tr.chFormat + epgd.pages.help.getIcon('sTChFormat') + '</label><input id="tChFormat" readonly onclick="epgd.timerEditChFormat(this)" /></div>' + + '<div><label for="tTime"><input type="checkbox" id="tTime" /> ' + epgd.tr.dateTimePicker.timeText + epgd.pages.help.getIcon('sTime') + '</label></div>'); + $(form.tWeek[0]).before('<span>' + epgd.tr.dateTimePicker.timeTextBetween + ' <input type="text" id="tStart" style="width:40px" /> - <input type="text" id="tEnd" style="width:40px" /></span>') + .parent().append('<br /><span class="onlyTypeS">' + tr.nextDays.replace('$field$','<input style="width:40px" type="text" id="tNextDays" />') + '</span>').insertAfter(form.tTime.parentNode); + $([form.tStart,form.tEnd]).timepicker({
+ alwaysSetTime: false
+ }); + $([form.tTime, form.tRepeat, form.tAdv]).change(function () {
+ $(this).parent().next().toggle(this.checked);
+ }); + $([form.tSFSeason, form.tSFSPart, form.tSFYear]).change(function () {
+ this.value = this.value.replace(/[^0-9-]/g, ''); + if (this.value.length == 1 && this.value == '-') + this.value = '';
+ }); + $(form.tType).append('<option value="S">' + epgd.tr.menu.search + '</option>'); + epgd.utils.addAutoComplete(form.tChannels, { source: epgd.channels.autoCompleteData, multiselect: true }); + epgd.utils.addAutoComplete(form.tSFCat, { source: epgd.categories, multiselect: true }); + epgd.utils.addAutoComplete(form.tSFGenre, { source: epgd.genres, multiselect: true }); +}; +epgd.searchTimerDialog.prototype.render = function (t) {
+ t = t || { searchfields: 1 }; + epgd.searchTimerDialog.base.render.call(this, t); + var form = this.form, + d, i; + form.tExpr.value = t.expression || ''; + $(form.tSMode).val(t.searchmode || 4); + form.tCaseSens.checked = t.casesensitiv == 1; + d = t.searchfields || 0; + for (i = 0, f = 1; i < form.tSFields.length; i++, f *= 2) + form.tSFields[i].checked = (d & f); + if (t.starttime || t.endtime || t.weekdays || t.nextdays) {
+ form.tTime.checked = true; + t.starttime ? $(form.tStart).datetimepicker('setTime', new Date(0, 0, 0, parseInt(t.starttime / 100, 10), (t.starttime % 100))) : form.tStart.value = ''; + t.endtime ? $(form.tEnd).datetimepicker('setTime', new Date(0, 0, 0, parseInt(t.endtime / 100, 10), (t.endtime % 100))) : form.tEnd.value;
+ form.tNextDays.value = t.nextdays || '';
+ } else
+ form.tTime.checked = false; + $(form.tTime).change(); + d = t.repeatfields || 0; + for (i = 0, f = 1; i < form.tRFields.length; i++, f *= 2) + form.tRFields[i].checked = (d & f); + form.tRepeat.checked = d > 0; + $(form.tRepeat).change(); + + form.tSFEpisode.value = t.episodename || ''; + form.tSFSeason.value = t.season || ''; + form.tSFSPart.value = t.seasonpart || ''; + form.tSFYear.value = t.year || ''; + + epgd.utils.setAutoCompleteValues(form.tSFCat, new String(t.category).replace(/'/g, '').split(',')); + epgd.utils.setAutoCompleteValues(form.tSFGenre, new String(t.genre).replace(/'/g, '').split(',')); + d = t.tipp || ''; + for (i = 0; i < form.tSFTip.length; i++) + form.tSFTip[i].checked = d.indexOf("'" + form.tSFTip[i].value + "'") >= 0; + form.tSFNoEpgMatch.checked = t.noepgmatch == 1; + + form.tAdv.checked = t.episodename || t.season || t.seasonpart || t.year || t.category || t.genre || t.tipp || t.noepgmatch; + $(form.tAdv).change(); + epgd.utils.setAutoCompleteValues(form.tChannels, new String(t.channelids).split(',')); + + if (t.chexclude) + form.tChExclude1.checked = 1; + else + form.tChExclude0.checked = 1; + form.tChFormat.value = t.chformat || (t.id ? '' : epgd.profile.chFormat); + form.tNameMode.defaultIndex = parseInt(t.category == 'Serie' ? epgd.profile.namingModeSearchSerie : epgd.profile.namingModeSearchMovie, 10); + form.tNameMode.selectedIndex = t.namingmode || form.tNameMode.defaultIndex; + form.tTemplate.value = t.template || (t.category == 'Serie' ? epgd.profile.namingModeSearchSerieTemplate : epgd.profile.namingModeSearchMovieTemplate);
+ $(form.tNameMode).change();
+ this.$win.parent().find('#tBCopy').toggle(!!t.id);
+}; +epgd.searchTimerDialog.prototype.getData = function (dontValid) {
+ var form = this.form, + d, i, + data = { expression: form.tExpr.value }; + if (form.tSFSeason.value) data.season = form.tSFSeason.value; + if (form.tSFSPart.value) data.seasonpart = form.tSFSPart.value; + if (form.tSFYear.value) data.year = form.tSFYear.value; + if (!dontValid) {
+ if (!data.expression) + return this.showError(epgd.tr.error.emptyField.replace("$field$", epgd.tr.pages.search.searchExpression), form.tExpr); + if (data.season && !/^[0-9]{0,3}-?[0-9]{0,3}$/.test(data.season)) + return this.showError(epgd.tr.error.invalid, form.tSFSeason); + if (data.seasonpart && !/^[0-9]{0,3}-?[0-9]{0,3}$/.test(data.seasonpart)) + return this.showError(epgd.tr.error.invalid, form.tSFSPart); + if (data.year && !/^((19|20)[0-9]{2})?(-|-(19|20)[0-9]{2})?$/.test(data.year)) + return this.showError(epgd.tr.error.invalid, form.tSFYear);
+ } + if (form.tID.value) data.id = parseInt(form.tID.value, 10); + if (form.tSFEpisode.value) data.episodename = form.tSFEpisode.value; + data.category = epgd.utils.getAutoCompleteValues(form.tSFCat, "'"); + data.genre = epgd.utils.getAutoCompleteValues(form.tSFGenre, "'"); + d = ''; + for (i = 0; i < form.tSFTip.length; i++) + if (form.tSFTip[i].checked) d += ",'" + form.tSFTip[i].value + "'"; + data.tipp = d.slice(1); + data.noepgmatch = form.tSFNoEpgMatch.checked ? 1 : 0; + + data.searchmode = parseInt($(form.tSMode).val(), 10); + data.searchfields = 0; + for (i = 0, f = 1; i < form.tSFields.length; i++, f *= 2) + if (form.tSFields[i].checked) + data.searchfields += f; + data.casesensitiv = form.tCaseSens.checked ? 1 : 0; + data.repeatfields = 0; + if (form.tRepeat.checked) {
+ for (i = 0, f = 1; i < form.tRFields.length; i++, f *= 2) + if (form.tRFields[i].checked) + data.repeatfields += f;
+ } + data.active = form.tInactive.checked ? 0 : 1; + + data.channelids = epgd.utils.getAutoCompleteValues(form.tChannels); + data.chformat = form.tChFormat.value; + data.chexclude = form.tChExclude1.checked ? 1 : 0; + if (form.tTime.checked) {
+ data.starttime = parseInt(form.tStart.value.replace(':', ''), 10); + data.endtime = parseInt(form.tEnd.value.replace(':', ''), 10);
+ data.weekdays = 0; + for (i = 0, f = 1; i < form.tWeek.length; i++, f *= 2) + if (form.tWeek[i].checked) + data.weekdays += f;
+ } + data.vps = form.tVPS.checked ? 1 : 0; + if (form.tPrio.value) data.priority = parseInt(form.tPrio.value, 10); + if (form.tLife.value) data.lifetime = parseInt(form.tLife.value, 10); + //if (form.t) data.childlock = form.t; + data.directory = form.tFolder.value; + d = $(form.tVdr).val(); + if (d) data.vdruuid = d; + //if (!dontValid || form.tNameMode.defaultIndex != form.tNameMode.selectedIndex) + data.namingmode = form.tNameMode.selectedIndex; + data.template = form.tTemplate.value; + data.type = $(form.tType).val(); + if (data.type == 'V' && !d && !dontValid) + return this.showError(epgd.tr.error.emptyField.replace("$field$", "VDR"), form.tVdr); + data.name = form.tSName.value; + if (form.tNextDays.value) data.nextdays = parseInt(form.tNextDays.value,10); + return data;
+} +epgd.searchTimerDialog.prototype.save = function (d, url, failFunc, succFunc) {
+ d = d || this.getData();
+ var self = this,
+ id= d.id,
+ name= d.name;
+ d.max = 0;
+ d.id && delete d.id;
+ d.name && delete d.name;
+ epgd.utils.loader.process(function () {
+ epgd.ajax({
+ url: epgd.login.url + "data/search", + type: 'post', + data: JSON.stringify(d)
+ }, function (data) {
+ d.id = id;
+ d.name = name;
+ if (data.count > 50) {
+ epgd.utils.confirm(epgd.tr.pages.timerList.confirmSaveBigResult.replace('$cnt$', data.count), function (ok) {
+ ok && epgd.searchTimerDialog.base.save.call(self, d);
+ });
+ } else
+ epgd.searchTimerDialog.base.save.call(self, d, url, failFunc, succFunc);
+ epgd.utils.loader.close();
+ });
+ },true);
+} +// Suche - Klasse +epgd.searchDialog = epgd.utils.inherits(function () {
+ epgd.searchTimerDialog.call(this, {
+ id: 'search', + embed: true,
+ buttons: null
+ }); + this.searchResultList = new epgd.searchResultList({
+ empty: epgd.tr.pages.search.empty
+ }, this); +}, epgd.searchTimerDialog); +epgd.searchDialog.prototype.create = function () {
+ epgd.searchDialog.base.create.call(this);
+ var form = this.form,
+ search= this,
+ $result = $('<div id="searchResult"></div>').appendTo(this.$win);
+ $('<button type="submit" id="sSearch" class="iAsButton i-search">' + epgd.tr.pages.search.search + '</button>')
+ .insertAfter(form.tExpr)
+ .after(' <input type="checkbox" id="sAdv" /> <label for="sAdv">' + epgd.tr.advanced + '</label>');
+ $(form.tType).parent().hide().parent().css('border-top','1px solid #ccc').insertAfter($(form.tVdr.parentNode.parentNode).hide());
+ $('<input type="button" class="iAsButton" id="tCopy" value="' + epgd.tr.copy + '" />').insertAfter(form.tSName).click(function () {
+ search.form.tID.value = '';
+ search.form.tSName.value += ' copy';
+ search.form.tSName.select();
+ }).prop("disabled", true);
+ $('<input type="button" class="iAsButton" id="tDel" value="' + epgd.tr.del + '" />').insertAfter(form.tSName).click(function () {
+ search.list.del(this.form.tID.value, function () { search.form.tID.value = '';search.loadSavedSearch() });
+ }).prop("disabled", true); $('<input type="button" class="iAsButton" value="' + epgd.tr.save + '" />').insertAfter(form.tSName).click(function () {
+ var d = search.getData();
+ if (!d.name)
+ return this.showError(epgd.tr.error.invalid, form.tSName);
+ search.save(d, null, null, function () { search.loadSavedSearch() });
+ });
+ $(form).submit(function () {
+ search.search($result);
+ return false;
+ }); + this.$win.find('#sExpr').keyup(function (ev) { if (ev.keyCode == 13) { this.form.sSearch.click(); $(this).blur(); } }).focus(); + //$(form.tExpr).parent().next().nextAll().wrapAll('<div id="sAdvView"/>'); + this.$win.find('#sAdv').change(function () {
+ $(form).toggleClass("noAdv", !this.checked); + search.resize(); + }).prop('checked', epgd.profile.searchAdv == "1").change(); + $(form.tSName).autocomplete({
+ minLength: 0, + maxHeight: 300,
+ source:function(){return false}, // damit bei einem focus kein error ausgelöst wird
+ select: function (ev, ui) {
+ var d = ui.item.data || { id: '' };
+ if (d.id) {
+ search.render(d);
+ search.form.sSearch.click();
+ $([form.tDel, form.tCopy, form.tInactive]).prop("disabled", false);
+ return false;
+ } else {
+ form.tID.value = '';
+ $([form.tDel, form.tCopy, form.tInactive]).prop("disabled", true);
+ }
+ }
+ }).focus(function () {
+ $(this).autocomplete("search", "");
+ }); + this.loadSavedSearch();
+} +epgd.searchDialog.prototype.loadSavedSearch = function () {
+ var form = this.form;
+ epgd.ajax({ url: epgd.login.url + "data/searchtimers?type=S" }, function (data) {
+ var list = [];
+ $.each(data.searchtimers, function (id, t) {
+ list.push({ value: t.name || t.expression, label: t.name || t.expression, data: t });
+ });
+ $(form.tSName).autocomplete("option", "source", list);
+ });
+} +epgd.searchDialog.prototype.resize = function () {
+ var $result = this.$win.find('#searchResult'), + h = $(window).height() - $result.offset().top - 20; + if (h < 100) + $result.css({ 'height': 'auto', 'overflow-y': 'visible' }); + else + $result.css({ 'height': h + 'px', 'overflow-y': 'auto' });
+} +epgd.searchDialog.prototype.render = function (t) {
+ if (!epgd.$con.find('#search').length) {
+ $('#menu_search').addClass("menu-active"); + this.create();
+ epgd.$con.html(''); + this.$win.appendTo(epgd.$con); + } + t = t || { searchfields: 1 };
+ t.type = 'S';
+ epgd.searchDialog.base.render.call(this, t);
+}
+epgd.searchDialog.prototype.close = function () { }
diff --git a/http/src/js/channels.js b/http/src/js/channels.js new file mode 100644 index 0000000..add3035 --- /dev/null +++ b/http/src/js/channels.js @@ -0,0 +1,46 @@ +epgd.channels = { + list: null, + autoCompleteData: null, + isDirty: false, + selBox: $('<select id="selChannel"></select>')[0], + load: function () { + if (!this.list || this.isDirty) { + epgd.ajax({ url: epgd.login.url + "data/channels", async: false, cache: false},function (data) { + var logoPath = (epgd.profile.channelLogoPath ? epgd.profile.channelLogoPath + '?maxW=70&maxH=50&id=' : false), + channelOpt = '', + list = {}, + ac_data = []; + data.channels && $.each(data.channels, function (i, channel) { + var id = channel.channelid || i; + if (channel.name) { + channel.html = '<div class="channel" id="' + id + '">' + (logoPath ? '<img src="' + logoPath + id + '" alt="' + channel.name + '" />' + + '<i class="i-tv" title="' + epgd.tr.pages.eventDetail.ch_switch + '" />' + + (epgd.profile.logoShowName == "1" ? channel.name : '') : channel.name) + '</div>'; + channel.visible & 1 && (channelOpt += '<option value="' + id + '">' + channel.name + '</option>'); + } + else { + channel.html = '<div class="channel" id="' + id + '">' + + '<i class="i-tv" title="' + epgd.tr.pages.eventDetail.ch_switch + '" />' + id + '</div>'; + channel.visible & 1 && (channelOpt += '<option value="' + id + '">' + id + '</option>'); + } + list[id] = channel; + ac_data.push({ label: channel.name, value: id }); + }); + epgd.channels.list = list; + epgd.channels.autoCompleteData= ac_data; + $(epgd.channels.selBox).html(channelOpt); + $(window).trigger('channels_load'); + this.dirty = false; + }); + } + }, + getHtml: function (id) { + var ch = this.list[id]; + return ch ? ch.html : '<div class="channel" id="' + id + '">' + + '<i class="i-tv" title="' + epgd.tr.pages.eventDetail.ch_switch + '" />' + id + '</div>'; + }, + getName: function (id) { + var ch = this.list[id]; + return ch ? ch.name : id; + } +};
diff --git a/http/src/js/epgd b/http/src/js/epgd new file mode 100644 index 0000000..8673096 --- /dev/null +++ b/http/src/js/epgd @@ -0,0 +1,3 @@ +var epgd = { + pages: {} +}; diff --git a/http/src/js/eventDetail.js b/http/src/js/eventDetail.js new file mode 100644 index 0000000..8ff8548 --- /dev/null +++ b/http/src/js/eventDetail.js @@ -0,0 +1,523 @@ +epgd.eventDetail = function (id) { + this.id = id; + this.data = null; + this.expire = 0; +} +epgd.eventDetail.prototype.imgPath = false; +epgd.eventDetail.prototype.load = function (channelId, time) { + var self = this; + epgd.ajax({ + url: epgd.login.url + "data/event?" + (channelId && time ? "channelid=" + channelId + "&time=" + time : "id=" + this.id), async: false, cache: false + }, function (data) { + self.data = data.event; self.id = data.id; self.expire = epgd.utils.now().getTime() + 900000; + }); //15*60*1000 + return this; +} +epgd.eventDetail.prototype.render = function () { + if (this.expire < epgd.utils.now().getTime()) + this.load(); + if (!this.data) + return ''; + this.win.render(this); +}; +epgd.eventDetail.prototype.doRecord = function (eData) { + if (eData === true) return epgd.tr.pages.eventDetail.record; // eData = getTitle + eData = eData || this.data; + var tData = { + id: eData.timerid, + eventid: eData.id, + channelid: eData.channelid, + title: eData.title, + evStartTime: eData.starttime, + evDuration: eData.duration, + category: eData.category, + shorttext: eData.shorttext, + expression: eData.title + }; + if (tData.eventid) + epgd.pages.timerList.dialog.render(tData); + else + epgd.pages.searchTimerList.dialog.render(tData); +} +epgd.eventDetail.prototype.doRepeat = function (checkAvail) { + if (checkAvail) return true; + var win = this.win, + $repeatHdl = win.$con.find('.repeat'), + searchData; + if (!$repeatHdl.length) { + if (!this.searchResultList) {
+ this.searchResultList = new epgd.searchResultList(null, {
+ resize: function () {
+ win.$con.last().find('td[data-evId="' + win.detail.data.id + '"]').parent().remove(); + win.$con.accordion("refresh"); + $repeatHdl.click();
+ }
+ });
+ } + $repeatHdl = $('<h3 class="repeat">' + epgd.tr.pages.eventDetail.repeat + '</h3>').appendTo(win.$con); + searchData = { searchfields: 1, expression: this.data.title, searchmode: 1, casesensitiv: 1, fromEventDetail: true }; + if (this.data.shorttext) { + searchData.searchfields1= 2; + searchData.expression1 = this.data.shorttext; + } + epgd.pages.search.search.call(this, $('<div class="desc"></div>').appendTo(win.$con), searchData); + } else + $repeatHdl.click(); +} +epgd.eventDetail.prototype.doPlay = function (checkAvail) { + var t = parseInt(epgd.utils.now().getTime() / 1000, 10) - this.data.starttime; + if (t < 0 || t > this.data.duration) + return false; + if (checkAvail) return true; + epgd.vdrs.current.switchChannel(this.data.channelid); +} +epgd.eventDetail.prototype.doPrev = function (checkAvail) { + var t = this.data.starttime - 500, + self = this; + if (t < epgd.profile.minEventTime) + return false; + if (checkAvail) return true; + epgd.utils.loader.process(function () { + new epgd.eventDetail().load(self.data.channelid, t).render(); + }); +} +epgd.eventDetail.prototype.doNext = function (checkAvail) { + var t = this.data.starttime + this.data.duration + 500, + self = this; + if (t > epgd.profile.maxEventTime) + return false; + if (checkAvail) return true; + epgd.utils.loader.process(function () { + new epgd.eventDetail().load(self.data.channelid, t).render(); + }); +} + +epgd.eventDetail.win = function () { + this._create(); + this.closed = true; + this.detail = null; + var win = this; + $(window).bind("epgd_close.eventDetail", function () { + if (!win.closed) { + //win.$win.css('left', ''); + win.$win.css('z-Index', ''); + win.$win.hide(); + $(document).unbind("keyup.eventDetail"); + win.closed = true; + win.$openDialogs && win.$openDialogs.removeClass("ui-state-disabled"); + } + }); + $(window).bind("resize.eventDetail", function (ev) { + if (!win.closed) { + try { + win.$win.css("max-width", $(window).width()); + win.$win.show().position({ of: window }); + win.$con.accordion("refresh"); + } catch (e) { } + if (parseInt(win.$win.css('top'), 10) < 69) + win.$win.css('top', '69px'); + }; + }); +} +epgd.eventDetail.win.prototype._create = function () { + this.imgPath = epgd.profile.eventImgPath ? epgd.profile.eventImgPath + '?no=0&maxW=270&maxH=146&id=' : false; + this.movieImgPath = epgd.profile.movieMediaPath ? epgd.profile.movieMediaPath + '?actor_id=0&movie_id=' : false; + this.movieActorImgPath = epgd.profile.movieMediaPath ? epgd.profile.movieMediaPath + '?maxW=60&maxH=90&media_type=4&actor_id=' : false; + this.serieImgPath = epgd.profile.serieImgPath ? epgd.profile.serieImgPath + '?actor_id=0&series_id=' : false; + this.serieActorImgPath = epgd.profile.serieImgPath ? epgd.profile.serieImgPath + '?maxW=60&maxH=90&season_number=0&episode_id=0&media_type=11&actor_id=' : false; + + this.$win = $('<div id="eventDetail" class="ui-front">' + + '<div class="ui-front ui-widget ui-widget-content ui-corner-all" style="position:absolute;width:100%;height:100%">' + + '<div class="toolbar ui-widget-header ui-corner-all"></div>' + + '<div></div>' + + '</div>' + + '<div class="ui-widget ui-widget-shadow ui-corner-all" style="position:absolute;width:100%;height:100%"></div>' + + '</div>').appendTo(document.body); + this.$con = this.$win.find(':first :last'); + var win = this, + tr = epgd.tr.pages.eventDetail, + toolbar = this.$win.find('.toolbar')[0]; + this.$rec= $('<button class="iAsButton i-record"/>').css('float', 'left').appendTo(toolbar).click(function () { win.detail.doRecord() }); + $('<button class="iAsButton i-buffer" title="' + tr.repeat + '" />').css('float', 'left').appendTo(toolbar).click(function () { win.detail.doRepeat() }); + this.$play = $('<button class="iAsButton i-tv" title="' + tr.ch_switch + '" />').css('float', 'left').appendTo(toolbar).click(function () { win.detail.doPlay() }); + this.$prev = $('<button class="iAsButton i-rewind" title="' + tr.eventPrev + '" />').appendTo(toolbar).click(function () { win.detail.doPrev() }); + this.$next = $('<button class="iAsButton i-forward" title="' + tr.eventNext + '" />').appendTo(toolbar).click(function () { win.detail.doNext() }); + $('<button class="iAsButton i-cancel" title="' + epgd.tr.close + '" />').css('float', 'right').appendTo(toolbar).click(function () { $(window).trigger("epgd_close.eventDetail"); }); +} + +epgd.eventDetail.win.prototype.render = function (detail) { + this.detail = detail; + var e = detail.data, + tr = epgd.tr.pages.eventDetail, + progress = ((parseInt(epgd.utils.now().getTime() / 1000, 10) - e.starttime) / e.duration * 100), + stars = '', + ep = e.episode || {}, + desc = e.longdescription ? '<div title="longdescription">' + e.longdescription + '</div>' : '', + extInfo = '', + actors = null, + mainImg = (this.imgPath && e.imagecount ? this.imgPath + e.id : ''), + firstImg = null, + constTitle= ep.episodename || e.title, + isMobile = $(window).width() < 500, + terms, i, sc, actor, info1, info2, + recordings= ''; + if (e.cntlongdescription) + desc += '<hr><div title="cntlongdescription">' + e.cntlongdescription + '</div>'; + if (e.rating) { + terms = e.rating.slice(e.rating.indexOf('/')).split(' '); + for (i = 1; i < terms.length; i += 3) + stars += terms[i] + '<div class="stars' + terms[i + 1].length + '"> </div>'; + } + + extInfo = ""; + for (i in tr.extInfo) + if (e[i]) extInfo += '<tr><th>' + tr.extInfo[i] + '</th><td>' + e[i] + '</td></tr>'; + + if (e.scraper && (sc = e.scraper.movie || e.scraper.serie)) { + sc.media = sc.media || []; + if (sc.actors) { + actors = ''; + for (i in sc.actors) { + actor = sc.actors[i]; + actors += '<div>' + (this.movieActorImgPath && actor.actorid ? '<img src="' + this.movieActorImgPath + actor.actorid + '" />' : '') + + '<a href="' + epgd.profile.movieActorPath + actor.actorid + '" target="_blank">' + actor.actorname + '</a>' + (actor.actorrole || '') + '</div>'; + } + } + if (e.scraper.movie) { + sc.isMovie= true; + if ( sc.media && this.movieImgPath){ + if (!mainImg && sc.media["1"]) + mainImg = this.movieImgPath + sc.movieid + '&media_type=1&maxW=270&maxH=146'; + if (sc.media["3"]) + firstImg = this.movieImgPath + sc.movieid + '&media_type=3&maxW=400&maxH=999'; + else if (sc.media["1"]) + firstImg = this.movieImgPath + sc.movieid + '&media_type=1&maxW=400&maxH=999'; + } + + if (sc.actors) { + actors = ''; + for (i in sc.actors) { + actor = sc.actors[i]; + actors += '<div>' + (this.movieActorImgPath ? '<img src="' + this.movieActorImgPath + i + '" />' : '') + + '<a href="' + epgd.profile.movieActorPath + i + '" target="_blank">' + actor.actorname + '</a>' + (actor.actorrole || '') + '</div>'; + } + } + if (sc.overview) + desc = '<div title="overview">' + sc.overview + "</div><hr />" + desc; + + /* 0=mmPoster, 1=mmFanart, 2=mmCollectionPoster, 3=mmCollectionFanart, 4=mmActorThumb, 5=mmPosterThumb */ + extInfo = '<h3><span>' + tr.scrapperMovieInfo + '</span></h3><div>' + + '<table class="colFull">' + + (sc.media["1"] && this.movieImgPath ? '<tr><th colspan="2"><img src="' + this.movieImgPath + sc.movieid + '&media_type=1&maxW=397&maxH=400" /></th></tr>' : '') + + (sc.title ? '<tr><th>' + tr.title + '</th><td>' + sc.title + '</td></tr>' : '') + + (sc.originaltitle ? '<tr><th>' + tr.original_title + '</th><td>' + sc.originaltitle + '</td></tr>' : '') + + (sc.runtime ? '<tr><th>' + tr.runtime + '</th><td>' + sc.runtime + ' ' + epgd.tr.minutes + '</td></tr>' : '') + + (sc.movie_release_date ? '<tr><th>' + tr.release_date + '</th><td>' + sc.movie_release_date + '</td></tr>' : '') + + (sc.genres ? '<tr><th>' + tr.genre + '</th><td>' + sc.genres.replace(/^\||\|$/g, '').replace(/ ?\| ?/g, ', ') + '</td></tr>' : '') + + (sc.voteaverage ? '<tr><th>' + tr.vote_average + '</th><td class="stars"><div class="stars5" style="width:' + parseInt(sc.voteaverage * 8, 10) + 'px"></div> (' + sc.voteaverage.toFixed(1) + ' / 10)</td></tr>' : '') + + (sc.popularity ? '<tr><th>' + tr.popularity + '</th><td>' + sc.popularity.toFixed(1) + '</td></tr>' : '') + + extInfo + + (sc.budget ? '<tr><th>Budget</th><td>$' + sc.budget + '</td></tr>' : '') + + (sc.revenue ? '<tr><th>Einnahmen</th><td>$' + sc.revenue + '</td></tr>' : '') + + (sc.homepage ? '<tr><th>' + tr.homepage + '</th><td><a href="' + sc.homepage + '">' + sc.homepage + '</a></td></tr>' : '') + + '</table>' + + (sc.media["0"] && this.movieImgPath ? '<img class="poster" src="' + this.movieImgPath + sc.movieid + '&media_type=0&maxW=390&maxh=999" />' : ''); + } else { + sc.isSerie = true; + /*0=msBanner1, 1=msBanner2, 2=msBanner3, 3=msPoster1, 4=msPoster2, 5=msPoster3, 7=msFanart1,8=msFanart2, 9=msFanart3, + 6=msSeasonPoster, 10=msEpisodePic, + 11=msActorThumb, 12=msPosterThumb, 13=msSeasonPosterThumb, */ + if (sc.actors) { + actors = ''; + for (i in sc.actors) { + actor = sc.actors[i]; + actors += '<div>' + (this.serieActorImgPath ? '<img src="' + this.serieActorImgPath + i + '&series_id=' + sc.seriesid + '" />' : '') + + '<a>' + actor.actorname + '</a>' + (actor.actorrole ? actor.actorrole.replace(/\|/g, '<br />') : '') + '</div>'; + } + } + terms = sc.episode; + if (terms) { + if (terms.episodeoverview){ + if ( e.longdescription && terms.episodeoverview.length > e.longdescription.length)
+ desc = desc.replace(/^<div.+<\/div>/i, ''); + desc= '<div title="episodeoverview">' + terms.episodeoverview + '</div>' + desc; + } + desc = '<h5>' + terms.episodename + '</h5>' + desc; + if (terms.episodegueststars) + actors += '</div><div class="colFull actors"><h5>' + tr.gueststars + '</h5><br />' + terms.episodegueststars.replace(/^\||\|$/g, '').replace(/\|/g, '<br />'); + } + if (!mainImg && sc.media["10"] && this.serieImgPath) + mainImg = this.serieImgPath + sc.seriesid + '&season_number=' + terms.seasonnumber + '&episode_id=' + terms.episodeid + '&media_type=10&maxW=270&maxH=146'; + if (sc.media["7"]) + firstImg = this.serieImgPath + sc.seriesid + '&season_number=0&episode_id=0&media_type=7&maxW=400&maxh=999'; + if (sc.seriesoverview) + desc += desc ? '<hr /><a href="#" onclick="return !$(this).next().toggle()">Serienbeschreibung</a><div style="display:none" title="seriesoverview">' + sc.seriesoverview + "</div>" : '<div>' + sc.seriesoverview + '</div>'; + extInfo = '<h3><span>' + tr.scrapperSerieInfo + '</span></h3><div>' + + '<table class="colFull">' + + (sc.media["1"] && this.serieImgPath ? '<tr><th colspan="2"><img src="' + this.serieImgPath + sc.seriesid + '&season_number=0&episode_id=0&media_type=1&maxW=397&maxH=250" /></th></tr>' : '') + + (sc.media["10"] && this.serieImgPath ? '<tr><th colspan="2"><img src="' + this.serieImgPath + sc.seriesid + '&season_number=' + terms.seasonnumber + '&episode_id=' + terms.episodeid + '&media_type=10&maxW=397&maxH=400" /></th></tr>' : '') + + (sc.seriesname ? '<tr><th>' + tr.title + '</th><td>' + sc.seriesname + '</td></tr>' : '') + + (sc.seriesnetwork ? '<tr><th>' + tr.network + '</th><td>' + sc.seriesnetwork + '</td></tr>' : '') + + (sc.seriesstatus ? '<tr><th>' + tr.seriesstatus + '</th><td>' + sc.seriesstatus + '</td></tr>' : '') + + (sc.seriesfirstaired ? '<tr><th>' + tr.release_date + '</th><td>' + sc.seriesfirstaired + '</td></tr>' : '') + + (sc.seriesgenre ? '<tr><th>' + tr.genre + '</th><td>' + sc.seriesgenre.replace(/^\||\|$/g, '').replace(/ ?\| ?/g, ', ') + '</td></tr>' : '') + + (sc.seriesrating ? '<tr><th>' + tr.vote_average + '</th><td class="stars"><div class="stars5" style="width:' + parseInt(sc.seriesrating * 8, 10) + 'px"></div> (' + sc.seriesrating.toFixed(1) + ' / 10)</td></tr>' : '') + + extInfo + + (epgd.profile.serieSeasonPath ? '<tr><td colspan="2"><a href="' + epgd.profile.serieSeasonPath + sc.seriesid + '" target="_blank">' + tr.homepage + '</a></td></tr>' : '') + + '</table>' + + (sc.media["6"] && this.serieImgPath ? '<img class="poster" src="' + this.serieImgPath + sc.seriesid + '&season_number=' + terms.seasonnumber + '&episode_id=0&media_type=6&maxW=390&maxh=999" />' : '') + + (sc.media["3"] && this.serieImgPath ? '<img class="poster" src="' + this.serieImgPath + sc.seriesid + '&season_number=0&episode_id=0&media_type=3&maxW=390&maxh=999" />' : ''); + } + } else { + sc = {}; + extInfo = '<h3><span>' + tr.extentedInfo + '</span></h3><div><table class="colFull">' + + '<tr><th>' + tr.title + '</th><td>' + e.title + '</td></tr>' + + (ep.partname ? '<tr><th>' + tr.part + '</th><td>' + ep.partname + '</td></tr>' : '') + + (e.year ? '<tr><th>' + tr.release_date + '</th><td>' + e.year + '</td></tr>' : '') + + (ep.lang ? '<tr><th>' + tr.lang + '</th><td>' + ep.lang + '</td></tr>' : '') + + extInfo + + '</table>'; + } + if (!actors && e.actor) + actors = e.actor.replace(/, /g, '<br />'); + actors && (extInfo += '<div class="colFull actors"><h5>' + tr.actors + '</h5>' + actors + '</div>'); + extInfo && (extInfo += '</div>'); + + info1 = (e.path ? epgd.tr.pages.timerList.folder + '<br />' + e.path.replace(/\//g, ' / ') + '<br />' : '') + + (e.genre ? (tr.genre + '<b>' + e.genre + '</b><br />') : '') + + (e.category ? tr.category + '<b>' + e.category + '</b><br />' : '') + + (e.country ? tr.country + '<b>' + e.country + '</b><br />' : '') + + (e.year ? tr.year + '<b>' + e.year + '</b><br />' : ''); + info2 = (ep.part ? tr.part + '<b>' + ep.part + (ep.parts ? ' / ' + ep.parts + '' : '') + '</b><br />' : '') + + (ep.season ? tr.season + '<b>' + ep.season + '</b><br />' : '') + + (ep.number ? tr.number + '<b>' + ep.number + '</b><br />' : ''); + + /* + e.recordings = [
+ {
+ "matchdensityshorttext": 12,
+ "owner": "7F13E490-09B3-401C-B26C-8B7F2F111014",
+ "name": "Star Wars: Episode III - Die Rache der Sith",
+ "duration": 10736,
+ "path": "Die_Biene_Maja/S03E04/2014-03-23.06.53.29-0.rec",
+ "md5path": "f6abd21ea13f52626723b3321c7a8c42",
+ "matchdensitytitle": 68,
+ "starttime": 1395553980,
+ "title": "Star Wars: Episode III - Die Rache der Sith",
+ "shorttext": "Science-Fiction (USA 2005)"
+ },
+ {
+ "matchdensityshorttext": 48,
+ "owner": "7F13E490-09B3-401C-B26C-8B7F2F111014",
+ "name": "Star Wars: Das Erwachen der Macht",
+ "duration": 8783,
+ "path": "Das_Traumhotel/2016-05-15.18.28.64-0.rec",
+ "md5path": "0279b0d04b68e891ef2b7e6d8bcdd059",
+ "matchdensitytitle": 70,
+ "starttime": 1463329680,
+ "title": "Star Wars: Das Erwachen der Macht",
+ "sho__rttext": "Star Wars - Episode VII: The Force Awakens"
+ }
+ ];
+ */ + + if (e.recordings) + for (i in e.recordings) {
+ terms= e.recordings[i];
+ recordings += '<div class="rec" data-start="' + terms.starttime + '" data-owner="' + (terms.owner || '') + + '" data-md5="' + terms.md5path + '" data-path="' + terms.path + '">' + + '<em>' + epgd.utils.formatDateTime(terms.starttime) + '</em><u>' + parseInt(terms.duration / 60, 10) + ' ' + epgd.tr.minutes + + '</u><b onclick="new epgd.recordDetail(this.parentNode).render()">' + + '<div class="progress" title="' + terms.matchdensitytitle + '% ' + epgd.tr.pages.search.matchdensity + '"><div style="width:' + terms.matchdensitytitle + '%" ></div></div>' + terms.title
+ + (terms.shorttext ? '<i><div class="progress" title="' + terms.matchdensityshorttext + '% ' + epgd.tr.pages.search.matchdensity + '"><div style="width:' + terms.matchdensityshorttext + '%" ></div></div>' + terms.shorttext + '</i>' : '') + + '</b></div>';
+ } + + this.$con = $('<div><h3><div class="date">' + $.datepicker.formatDate(isMobile ? 'd. M y' : 'd. MM yy', epgd.utils.date(e.starttime)) + '</div>' + + (isMobile ? '' : e.title) + '<div class="time"><b>' + + epgd.utils.formatTime(e.starttime) + '</b> – ' + epgd.utils.formatTime(e.starttime + e.duration) + + ' ' + epgd.tr.oClock + ' | ' + parseInt(e.duration / 60, 10) + ' ' + epgd.tr.minutes + '</div></h3>' + + '<div>' + + '<div class="colFull">' + + '<div class="imgBox">' + (mainImg ? '<img src="' + mainImg + '" />' : '') + '</div>' + + '<div class="chPrFl">' + + epgd.channels.getHtml(e.channelid) + + (progress > 0 && progress <= 100 ? '<div class="progress"><div style="width: ' + progress + '%"></div></div>' : '') + + '<div class="audio">' + + (e.flags && e.flags.indexOf('16:9') > 0 ? '<span class="a-169"></span>' : '') + + (e.audio && e.audio.indexOf('DolbyDigital') >= 0 ? '<span class="a-dd" title="DolbyDigital"></span>' : '') + + (e.flags && e.flags.indexOf('Live') > 0 ? 'Live' : '') + + (e.parentalrating ? '<div class="parRate' + e.parentalrating + '">' + tr.parentalrating + e.parentalrating + '</div>' : '') + + '</div>' + + (e.merge ? '<div>' + tr.mergeSrc + e.merge + '</div>' : '') + + '</div>' + + (stars ? '<div class="stars">' + stars + '</div>' : '') + + '<div class="col2">' + + e.title + (ep.partname ? '<br /><i>' + ep.partname + '</i>' : (e.shorttext ? '<br /><i>' + e.shorttext + '</i>' : '')) + + '</div><div class="col2 rate rate' + (e.numrating || '0') + '">' + + (e.tipp ? '<b class="tipp">' + e.tipp + '</b>' : '') + + (e.txtrating ? '<span>' + e.txtrating + '</span>' : '') + + (e.shortreview || '') + + '</div>' + + (info1 ? '<div class="info">' + info1 + '</div>': '') + + (info2 ? '<div class="info">' + info2 + '</div>' : '') + + (firstImg ? '<img src="' + firstImg + '" />' : '') + + '</div>' + + '<div class="colFull desc">' + (desc ? desc.replace(/\n/g, '<br />') : '') + '</div>' + + '</div>' + + extInfo + + (e.category == 'Serie' || sc.isSerie ? '<h3 data-conti="' + constTitle + '"><span>' + tr.constabelInfo + '</span></h3><div class="desc">' + + '<a class="iAsButton i-edit" href="' + epgd.profile.constabelEditPath + encodeURIComponent(constTitle) + '.episodes' + '" target="constabel">' + epgd.tr.edit + '</a>' + + '<a class="iAsButton i-link-ext" href="' + epgd.profile.constabelLinkPath + encodeURIComponent(constTitle) + '" target="constabel">' + epgd.tr.pages.eventDetail.addConstableLink + '</a>' + + epgd.pages.help.getButton('constabel',true) + + (epgd.profile.constabelLoginPath ? '<a class="iAsButton i-login" href="' + epgd.profile.constabelLoginPath + '" target="constabel">' + epgd.tr.pages.eventDetail.loginConstable + '</a>' : '') + + '<pre id="cRaw"></pre>' + + '</div>' + : '') + + (recordings ? '<h3><span>' + epgd.tr.menu.records + '</span></h3><div class="recordings">' + recordings + '</div>' : '') + + '</div>').replaceAll(this.$con); + this.$con.accordion({ + heightStyle: "fill", + header: "h3", + active: 0, + beforeActivate: function(ev, ui){ + if (ui.newHeader.attr('data-conti')) { + epgd.utils.loader.process(function () {
+ epgd.ajax({ url: epgd.login.url + 'data/proxy?id=constabel&title=' + encodeURIComponent(encodeURIComponent(ui.newHeader.attr('data-conti'))) + '&_' + new Date().getTime(), dataType: "html", contentType: "text/plain; charset=utf-8" }, function (data) {
+ if (data.indexOf('Error:') == -1) {
+ var $pre = ui.newPanel.find('#cRaw'), + thead = '<thead><tr><th>' + tr.season + '</th><th>' + tr.part + '</th><th>' + tr.number + '</th><th>' + tr.title + '</th>', + tbody = '<tbody>', + lines = data.split(/\r?\n/), + line, m, i; + for (i = 0; i < lines.length; i++) {
+ line = lines[i]; + if (line.charAt(0) == '#') {
+ m = line.match(/EXTRACOL[0-9] (.+)/i); + if (m) + thead += '<th>' + m[1] + '</th>';
+ } else {
+ m = line.split(/\t/); + if (m.length > 3) + tbody += '<tr><td>' + m.join('</td><td>') + '</td></tr>';
+ }
+ } + $pre.html(data).hide().before('<a href="#" onclick="return !!$(\'#cRaw\').toggle()[0].scrollIntoView()">Raw</a>'); + $pre.before('<table>' + thead + '</thead>' + tbody + '</tbody></table>');
+ } else
+ ui.newPanel.find('#cRaw').html(epgd.tr.error.noData);
+ epgd.utils.loader.close();
+ });
+ ui.newHeader.removeAttr('data-conti');
+ },true); + } + } + }); + this.$rec.toggleClass("hasTimer", !!e.timerid).prop("title", this.detail.doRecord(true)); + this.$play.toggle(this.detail.doPlay(true)); + this.$prev.toggle(this.detail.doPrev(true)); + this.$next.toggle(this.detail.doNext(true)); + this.$con.find('.channel .i-tv').click(function () { epgd.vdrs.current.switchChannel(this.parentNode.id); }); + //this.$win.position({ of: window }); + this.closed = false; + + i = Math.max.apply(null, this.$win.siblings(".ui-front:visible").map(function () { + return +$(this).css("z-index"); + }).get()); // zIndexMax + if (i >= +this.$win.css("z-index")) + this.$win.css("z-index", i + 1); + + $(window).trigger("resize.eventDetail"); + this.$openDialogs = $('.ui-dialog:visible:not(.ui-state-disabled)').addClass("ui-state-disabled"); + $(document).bind("keyup.eventDetail", function (e) { + if (e.keyCode == 27) {
+ $(window).trigger("epgd_close.eventDetail");
+ } + }); + epgd.pages.help.initButtons(this.$con); +} + +epgd.recordDetail = epgd.utils.inherits(function (elem) { + this.elem = elem; + return epgd.eventDetail.call(this); +}, epgd.eventDetail); +epgd.recordDetail.prototype.load = function () { + var self = this; + epgd.ajax({ + url: epgd.login.url + 'data/recording?starttime=' + this.elem.getAttribute('data-start') + '&md5path=' + this.elem.getAttribute('data-md5') + '&owner=' + this.elem.getAttribute('data-owner'), async: false + }, function (data) { + self.data = data.recording; + }); + return this; +} +epgd.recordDetail.prototype.doRecord = function (eData) {
+ if (eData === true) return epgd.tr.pages.records.similarTimer; // eData = getTitle + epgd.eventDetail.prototype.doRecord.call(this, eData); +} +epgd.recordDetail.prototype.doPlay = function (checkAvail) { + if (checkAvail) return true; + epgd.ajax({ url: epgd.login.url + 'data/replayrecording?vdruuid=' + ( !epgd.vdrs.list[this.data.vdruuid].usecommonrecfolder ? this.data.vdruuid : epgd.vdrs.current.uuid ) + '&starttime=' + this.data.starttime + '&md5path=' + this.data.md5path + '&owner=' + (this.data.owner || ''), cache: false }, function (data) { + epgd.utils.popup(data.result.message, { title: 'VDR', autoClose: 5000 }); + }); +} +epgd.recordDetail.prototype.doPrev = function (checkAvail) { + var $elem = $(this.elem).prev('.rec'); + if (!$elem.length) + return false; + if (checkAvail) return true; + $elem.find('B').click(); +} +epgd.recordDetail.prototype.doNext = function (checkAvail) { + var $elem = $(this.elem).next('.rec'); + if (!$elem.length) + return false; + if (checkAvail) return true; + $elem.find('B').click(); +} + +epgd.doneTimerDetail = epgd.utils.inherits(function (tr) {
+ this.tr = tr; + return epgd.eventDetail.call(this);
+}, epgd.eventDetail); +epgd.doneTimerDetail.prototype.load= function () {
+ var self = this; + epgd.ajax({ url: epgd.login.url + 'data/donetimer?id=' + this.tr.tData.id, async: false, cache: false }, function (data) {
+ var t = data.donetimer; + if (t.state) + t.cntlongdescription = epgd.pages.timerListDone.stateIcons[t.state]; + t.episode = { lang: t.episodelang, season: t.episodeseason, part: t.episodepart };
+ self.id = data.id; + self.expire = epgd.utils.now().getTime() + 900000;
+ delete t.timerid;
+ delete t.id;
+ self.data = t;
+ }); + return this;
+};
+epgd.doneTimerDetail.prototype.doRecord= function (eData) {
+ if (eData === true) return epgd.tr.pages.records.similarTimer; + epgd.eventDetail.prototype.doRecord.call(this, eData); + //epgd.pages.searchTimerList.dialog.render(eData || this.data); +}; +epgd.doneTimerDetail.prototype.doPlay= function (checkAvail) {
+ return false;
+}; +epgd.doneTimerDetail.prototype.doPrev= function (checkAvail) {
+ var $elem = $(this.tr).prev('tr'); + if (!$elem.length) + return false; + if (checkAvail) return true; + $elem.find('td').click();
+}; +epgd.doneTimerDetail.prototype.doNext= function (checkAvail) {
+ var $elem = $(this.tr).next('tr'); + if (!$elem.length) + return false; + if (checkAvail) return true; + $elem.find('td').click();
+};
+ + +$(document).ready(function () { + epgd.eventDetail.prototype.win = new epgd.eventDetail.win(); +});
\ No newline at end of file diff --git a/http/src/js/pages.editChannels.js b/http/src/js/pages.editChannels.js new file mode 100644 index 0000000..74883c3 --- /dev/null +++ b/http/src/js/pages.editChannels.js @@ -0,0 +1,313 @@ +epgd.pages.editChannels = { + /* $.get("http://wwwa.tvmovie.de/static/tvghost/html/onlinedata/cftv520/datainfo.txt").done(function(data){console.log(data)}) */ + + render: function () { + if (!(epgd.login.rights & epgd.rights.umConfigEdit) == epgd.rights.umConfigEdit) return epgd.utils.popup(epgd.tr.error.forbidden, { title: epgd.tr.error.error }); + var tr = epgd.tr.pages.editChannels, + $panel = epgd.$con, + $but, + lis='', + vdrs= '', + merge, + src, id, plg, uuid,ch; + for (id in epgd.channels.list) { + ch = epgd.channels.list[id]; + merge = []; + for (plg in ch.sources) { + src = ch.sources[plg]; + merge[src.merge] = '<li><u>' + plg + '</u> <input type="text" readonly value="' + src.extid + '" /></li>'; + } + //merge[99] = '<li>dvb</li>'; + lis+='<li><em class="i-check' + (ch.visible & 1 ? '' : '-empty') + + '"></em><em style="display:none" class="i-check' + (ch.visible & 2 ? '' : '-empty') + + '"></em><span>' + id + '</span><input type="text" value="' + (ch.name || '') + '" />' + //+ '<ol>' + merge.join('') + '</ol>' + + '</li>'; + }; + for (uuid in epgd.vdrs.list) + vdrs += '<li data-url="vdr&uuid=' + uuid + '">' + epgd.vdrs.list[uuid].name + '</li>'; + + /* + merge = []; + merge[1] = '<li><u>tvm</u> <input type="text" value="enter id" /></li>'; + merge[2] = '<li><u>epgdata</u> <input type="text" value="enter id" /></li>'; + //merge[99] = '<li>dvb</li>'; + <a class="ui-icon ui-icon-trash">Trash</a> + */ + $but = $panel.html('<div class="ui-widget"><div class="ui-state-highlight ui-corner-all" style="padding: 0.3em 0.7em; font-size:0.9em">' + + '<button class="iAsButton i-down-dir">' + tr.menu.channelList + '</button> ' + + '<span class="i-info-circled" style="display:inline-block"></span>' + epgd.tr.pages.editChannels.headline + + '</div></div>' + + '<div class="pageEditChannels" id="pageEditChannelsHead"><div class="selMarkBlock"><b title="' + epgd.tr.markAll + '" class="selected" data-t="1"></b><b title="' + epgd.tr.markNone + + '" data-t="0"></b><b title="' + epgd.tr.markToggle + '"><b class="selected"></b></b></div><div class="selMarkBlock" data-index="0" title="' + epgd.tr.pages.editChannels.checkWeb + + '">Web<em title="' + epgd.tr.markAll + '" class="iAsButton i-check"></em><em title="' + epgd.tr.markNone + + '" class="iAsButton i-check-empty"></em></div>' + //+ '<div data-index="1" title="' + epgd.tr.pages.editChannels.checkVDR + //+ '">VDR<em title="' + epgd.tr.markAll + '" class="iAsButton i-check"></em><em title="' + epgd.tr.markNone + //+ '" class="iAsButton i-check-empty"></em></div>' + + '<span><input type="text"/>channel-id</span><span><input type="text"/>channel-name</span>' + //+ '<div>merging</div>' + + '</div>' + ).find('button'); + + $but.click(function () { + var $menu = this.$menu.show(); + $(document).bind("click.ui_menu", function (ev) { + if (!$(ev.target).closest(".ui-menu").length) { + $menu.hide(); + $(this).unbind("click.ui_menu"); + } + }); + return false; + })[0].$menu = $('<ul style="font-size:0.8em; width:200px;position:absolute">' + + '<li data-id="loadList"><a>' + tr.menu.referenceList + '</a><ul style="width:100px">' + + '<li data-id="channelpedia"><a>channelpedia</a></li>' + + ( vdrs ? '<li><a>VDR</a><ul>' + vdrs + '</ul></li>' : '') + + '<li data-id="insertList"><a>' + tr.menu.insertAsText + '</a></li>' + + '</ul></li>' + + '<li data-id="getChannelNames"><a>' + tr.menu.extentEmptyChannelNames + '</a></li>' + + '<li data-id="getAllChannelNames"><a>' + tr.menu.applyAllChannelNames + '</a></li>' + + '<li data-id="getOrder"><a>' + tr.menu.applyChannelSort + '</a></li></ul>').hide().insertAfter($but).menu({ + select: function (ev, ui) { + var $li = ui.item, + ul, path, + filter = ''; + if (!$li.attr('data-id')) + $li = $li.parents('li[data-id]:first'); + switch ($li.attr('data-id')) { + case 'getChannelNames': + filter= '[value=""]'; + case 'getAllChannelNames': + epgd.utils.loader.process(function () { + var list = []; + $('#pageEditChannelsSource li').each(function () { + list[this.lastChild.innerHTML] = this.firstChild.innerHTML; + }) + $('#pageEditChannels > li > input' + filter).each(function () { + this.value = list[this.previousSibling.innerHTML] || this.value; + }); + }); + break; + case 'getOrder': + epgd.utils.loader.process(function () { + var $list = $('#pageEditChannels'), + $span; + $($('#pageEditChannelsSource span').get().reverse()).each(function () { + $span = $list.find('> li > span:contains(' + this.innerHTML + ')'); + if ($span.length) + $span.parent().prependTo($list); + }); + }); + break; + case 'insertList': + $('<div title="channel.conf"><p>' + tr.desc_insertList + ' <a href="http://channelpedia.yavdr.com/gen/DVB-S/S19.2E/S19.2E_complete_sorted_by_groups.channels.conf" target="forList">channelpedia.yavdr.com</p><textarea style="width:100%; height:60%"></textarea><button>ok</button></div>').dialog({ + modal: true, + width: 500, + height: 400 + }).find('textarea').change(function () { + epgd.pages.editChannels.insertReferenceList(this.value); + $(this).parent().dialog('destroy'); + }); + break; + case 'loadList': + if (ui.item.attr('data-url')) { + epgd.ajax({url:epgd.login.url + 'data/proxy?id=' + ui.item.attr('data-url'), dataType: "html", contentType: "text/plain; charset=utf-8"},epgd.pages.editChannels.insertReferenceList); + break; + } + case 'channelpedia': + ul = $('<ul style="width:100px" />').appendTo(ui.item)[0]; + epgd.ajax({url:epgd.login.url + 'data/proxy?id=channelpedia', dataType: "html", contentType: "text/plain; charset=utf-8"},function (data) { + $li.attr('data-id', ''); + var $ul = $(data.replace(/<img [^>]+>/g, '')).find('.entryMenu > ul:first'); + $ul.find('br').remove(); + $ul.find('a').each(function () { + this.parentNode.setAttribute('data-url', this.getAttribute("href")); + this.removeAttribute('href'); + }); + $ul.find('>li').each(function () { + $('<li data-id="channelpediaList"><a>' + this.firstChild.innerHTML + '</a></li>').append($(this).next('ul').width(400)).appendTo(ul); + }); + $(ev.target).menu("refresh").menu("expand"); + }); + return true; + case 'channelpediaList': + path = ui.item.attr('data-url'); + $li.attr('data-id', 'loadList'); + ui.item.removeAttr('data-url'); + epgd.ajax({ url: epgd.login.url + 'data/proxy?id=channelpedia&path=' + path, dataType: "html", contentType: "text/plain; charset=utf-8" }, function (data) { + var $ul = $('<ul />'); + $(data).find('.singleSourceMainMenu li:contains("channels.conf")').each(function () { + var $this = $(this); + $('<li title="' + $this.find('.description').text() + '" data-url="channelpedia&path=' + + path + $this.find('.button a').attr('href') + '"><a>' + + $this.find('.caption').text() + '</a></li>').appendTo($ul); + }); + $ul.appendTo(ui.item); + $(ev.target).menu("refresh").menu("expand"); + }); + return true; + default: + return false; + } + $(document).trigger("click.ui_menu"); + } + }).position({ + my: "left top", + at: "left bottom", + of: $but[0] + }); + $('<button class="iAsButton i-save">' + epgd.tr.save + '</button>').insertAfter($but).click(function () { + var data = {}; + $('#pageEditChannels > li').each(function (index) { + var $this = $(this), + sources = {}; + merge = {}; + $this.find('>ol>li').each(function (index) { + var $this = $(this), + extid = $this.find('input').val(); + sources[$this.find('u').text()] = merge = { merge: index }; + if (extid) merge.extid = extid; + }); + data[$this.find('span').text()] = { + name: $this.find('input').val(), + visible: $this.find('em:eq(0)').hasClass('i-check') * 1 + $this.find('em:eq(1)').hasClass('i-check') * 2, + order: index + 1, + sources: sources + } + }); + epgd.ajax({ + url: epgd.login.url + 'data/save-channels', + type: 'post', + data: JSON.stringify({ "channels": data }) + },function (data) { + data = data.result; + if (data.state == 200) { + epgd.utils.popup(epgd.tr.dataSaved); + epgd.channels.isDirty = true; + } + else + epgd.utils.popup(data.message); + }); + }); + + $('<ol id="pageEditChannels" class="pageEditChannels">' + lis + '</ol>').appendTo($panel).sortable({ + revert: 'invalid', + handle: ':not(em)' + }).click(function (ev) { + if (ev.target.nodeName == "EM") + $(ev.target).toggleClass('i-check i-check-empty'); + else { + $li = $(ev.target).closest('li'); + if ($li.parent('#pageEditChannels').length) { + $li.toggleClass('selected'); + if (ev.shiftKey && this.lastSel) { + var $lastSel = $(this.lastSel), + delta = $li.index() - $lastSel.index(); + if (delta > 0) + $lastSel.nextAll(':lt(' + delta + '):not(.filterHide)').toggleClass('selected', $lastSel.hasClass('selected')); + else + $lastSel.prevAll(':lt(' + -delta + '):not(.filterHide)').toggleClass('selected', $lastSel.hasClass('selected')); + } + else + this.lastSel = $li[0]; + } + } + }); + $('<ol id="pageEditChannelsSource" class="pageEditChannels"></ol>').appendTo($panel).sortable({ + connectWith: '#pageEditChannels', + revert: "invalid", + remove: function (e, ui) { + $('<li><em class="i-check"></em>' + //+ '<em class="i-check"></em>' + + '<span>' + ui.item.find('span').text() + + '</span><input type="text" value="' + ui.item.find('i').text() + '" />' + //+ '<ol></ol>' + +'</li>').insertAfter(ui.item); + return false; + }, + }).hide(); + $panel.append('<br clear="all" />'); + $(window).bind("resize.editChannels", function () { + var h = $(window).height() - $('#pageEditChannels').offset().top -20; + if ($('#pageEditChannelsSource:visible').length == 0 || ($panel.width() - $('#pageEditChannels').width() - $('#pageEditChannelsSource').width() - 80) > 0) + $('#pageEditChannels,#pageEditChannelsSource').css({ height: h }); + else { + $('#pageEditChannels').height(h*0.66); + $('#pageEditChannelsSource').height(h * 0.33); + } + }).trigger('resize'); + $(window).bind("epgd_close.editChannels", function () { + $(window).unbind(".editChannels"); + epgd.channels.load(); + }); + + /* + .find('ol').sortable({ + connectWith: "#mergeSrc" + }); + */ + /*, + cancel: ??? + accept: function (event, ui) { + console.log(ui); + return $(event.target).html().indexOf('>' + ui.item.find('u').text() + '<') > 0; + }*/ + /* + $('#mergeSrc').droppable({ + accept: "#pageEditChannels ol li", + drop: function (event, ui) { + $(ui.draggable).remove(); + } + }).find('li').draggable({ + connectToSortable: "#pageEditChannels ol", + helper: "clone", + }); + */ + + $('#pageEditChannelsHead em').click(function () { + var $sel = null, + $lis; + try { + $sel = $(window.getSelection().getRangeAt(0).cloneContents()).children(); + } catch (e) { $sel = null; } + if (!$sel || !$sel.length) { + $lis = $('#pageEditChannels > li'); + $sel = $lis.filter('.selected'); + if (!$sel.length) + $sel = $lis; + } + + $sel.find('> em:eq(' + this.parentNode.getAttribute('data-index') + ').i-check' + (this.className.indexOf('i-check-empty') > 0 ? '' : '-empty')).toggleClass('i-check i-check-empty'); + }); + + $('#pageEditChannelsHead b').click(function () { + var t = this.getAttribute('data-t'); + $('#pageEditChannels > li').toggleClass('selected', t == 1 ? true : t == 0 ? false : undefined); + return false; + }); + this.inp_ChID = $('#pageEditChannelsHead input:eq(0)').keyup(this.filter)[0]; + this.inp_ChName = $('#pageEditChannelsHead input:eq(1)').keyup(this.filter)[0]; + }, + filter: function () {
+ var id = epgd.pages.editChannels.inp_ChID.value.toLowerCase(),
+ name = epgd.pages.editChannels.inp_ChName.value.toLowerCase();
+ $('#pageEditChannels > li').each(function () {
+ var $li = $(this);
+ if ((!id || $li.find('span').text().toLowerCase().indexOf(id) >= 0) && (!name || $li.find('input').val().toLowerCase().indexOf(name) >= 0)) + $li.removeClass('filterHide'); + else + $li.addClass('filterHide');
+ }); + }, + insertReferenceList: function (data) { + var html = '', + terms; + $(data.split('\n')).each(function () { + terms = this.split(':'); + if (terms[0]) + html += '<li><i>' + terms[0].split(/,|;/)[0] + '</i><span>' + terms[3] + '-' + terms[10] + '-' + terms[11] + '-' + terms[9] + '</span></li>'; + }) + $('#pageEditChannelsSource').show().html(html); + $(window).trigger("resize.editChannels"); + } +}; diff --git a/http/src/js/pages.editUser.js b/http/src/js/pages.editUser.js new file mode 100644 index 0000000..e41b67c --- /dev/null +++ b/http/src/js/pages.editUser.js @@ -0,0 +1,96 @@ +epgd.pages.editUser = { + cur: null, + render: function () { + if (!(epgd.login.rights & epgd.rights.umConfigUsers) == epgd.rights.umConfigUsers) return epgd.utils.popup(epgd.tr.error.forbidden, { title: epgd.tr.error.error }); + var tr = epgd.tr.pages.editUser, + $form= $('<form></form>'), + $sel = $('<select size="10"></select>').change(function () { + epgd.pages.editUser.showUser(this[this.selectedIndex].data, $form, epgd.pages.editUser.render); + }); + $('<option>' + tr.add + '</option>').appendTo($sel)[0]; + epgd.$con.html('<div id="page_editUser"><div><h2>' + tr.user + '</h2></div></div>'); + epgd.ajax({ url: epgd.login.url + "data/users", cache: false }, function (data) { + for (var uName in data.users) { + $('<option>' + uName + '</option>').appendTo($sel)[0].data = data.users[uName]; + } + }); + epgd.$con.find('#page_editUser').append($form).children().first().append($sel); + }, + showUser: function (userData, $form, callback) { + epgd.pages.editUser.cur = userData || {"user": "", "active": 1, "rights": epgd.login.rights}; + var tr = epgd.tr.pages.editUser, + u = epgd.pages.editUser.cur, + rightForm = '', + um; + //epgd.rights = {}; for (var i = 1; i < 1025; i = i * 2) epgd.rights['um' + i] = i;// zum Test + for (um in epgd.rights) + rightForm += '<div><input type="checkbox"' + ((u.rights & epgd.rights[um]) == epgd.rights[um] ? ' checked="checked"' : '') + ' name="uRights" id="uR' + um + '" value="' + epgd.rights[um] + '"/><label for="uR' + um + '">' + (tr.rights[um] || um) + '</label></div>'; + $form.html((!u.user ? '<h2>' + epgd.tr.pages.login.userName + '</h2><div><input type="text" id="uName" value="" /></div><br />' : '') + + '<div><input type="radio"' + (u.active == "1" ? ' checked="checked"' : '') + ' name="uActive" value="1" id="uActive"/><label for="uActive">' + tr.active + '</label>' + + ' <input type="radio"' + (u.active == "0" ? ' checked="checked"' : '') + ' name="uActive" value="0" id="uInactive" /><label for="uInActive">' + tr.inActive + '</label>' + + (u.user && ' <input type="radio" name="uActive" value="-1" id="uDel"/><label for="uDel">' + epgd.tr.del + '</label>') + + '</div>' + + '<h2>' + epgd.tr.pages.login.password + '</h2><div><input type="password" id="uPass" /></div>' + + '<h2>' + tr.rights.label + '</h2><div>' + rightForm + '</div>' + + '<div><br /><button class="iAsButton i-save">' + epgd.tr.save + '</button></div>'); + $form.find('button').click(function () { + return epgd.pages.editUser.save(this.form, callback); + }); + $uRights = $($form[0].uRights).each(function () {
+ this.r = parseInt(this.value, 10);
+ }); + function check() {
+ var flag = this.r; + if (this.checked) + $uRights.each(function () { // Alle unterrechte automatisch setzen und fixieren
+ if (this.r < flag && (flag & this.r) == this.r) this.checked = this.disabled = true;
+ }); + else + $uRights.each(function () {
+ if (this.r < flag && (flag & this.r) == this.r) {
+ this.disabled = false; // Es ist ein Unterrecht, also erst mal wieder erlauben
+ var sub = this; // Suchen, ob dieses recht noch ein von einem weiteren Recht ein Unterrecht ist und dann ggf. wieder setzen und fixieren
+ $uRights.each(function () {
+ if (this.checked && this.r > sub.r && (this.r & sub.r) == sub.r) sub.checked = sub.disabled = true;
+ });
+ }
+ });
+ } + $uRights.each(check).click(check); + }, + save: function (form, callback) { + var u = {rights:1}, + cur = epgd.pages.editUser.cur; + $(form.uRights).each(function () { if (this.checked) u.rights |= this.r; }); + u.active = parseInt(form.uActive.value,10); + if (cur.user) { + u.user = cur.user; + if (u.active == -1) { + delete u.active; + u.state = 'D'; + } else { + u.state = 'M'; + if (u.active == cur.active) + delete u.active; + if (u.rights == cur.rights) + delete u.rights; + if (form.uPass.value) + u.passwd = YaMD5.hashStr(u.user + form.uPass.value); + } + } else{ + u.state = 'C'; + u.user = form.uName.value; + if (!u.user) + return !epgd.utils.topInfo(epgd.tr.error.emptyField.replace('$field$', epgd.tr.pages.login.userName), { isError: 1 }); + u.passwd = YaMD5.hashStr(u.user + form.uPass.value); + } + epgd.ajax({url: epgd.login.url + "data/save-users",type: 'post',data: JSON.stringify({ users: [u] })},function (data) { + if (data.Error || data.result.state != 200) + return epgd.utils.topInfo(data.Error || data.result.message, { isError: 1 }); + (u.user == epgd.login.user) && $(window).trigger("login_changed",u); + if ( $.isFunction(callback)) + callback(data); + }); + return false; + } +}; diff --git a/http/src/js/pages.help.js b/http/src/js/pages.help.js new file mode 100644 index 0000000..d63ebd6 --- /dev/null +++ b/http/src/js/pages.help.js @@ -0,0 +1,49 @@ +epgd.pages.help = { + $con: null, + render: function () { + $('#menu_help').addClass("menu-active"); + if (!this.$con) this.load(); + epgd.$con.html(this.$con); + this.init(); + }, + getButton: function(id, useAnchor){ + return (useAnchor ? '<a' : '<button') + ' id="bh_' + id + '" class="help iAsButton i-help" role="button">' + epgd.tr.menu.help + '</' + ( useAnchor ? 'a>' : 'button>'); + }, + getIcon: function (id) {
+ return '<a id="bh_' + id + '" class="help iAsIcon i-help" />';
+ }, + initButtons: function ($con) { + if (!$con) + $con = epgd.$con; + $con.tooltip({ + items: ".help", + //position: { at: "left top" }, + //position: { my: "left top" }, + tooltipClass: 'quickInfo', + content: function () { + return epgd.pages.help.getQuickInfo(this.id.slice(3)); + }, + open: function (ev, ui) {
+ $(ui.tooltip).position({
+ of: ev.toElement,
+ my: "left top"
+ });
+ ev.preventDefault();
+ } + }); + }, + getQuickInfo: function (id) { + var h= epgd.pages.help; + if (!h.$con) h.load(); + return h.$con.find('#h_' + id).html() || epgd.tr.pages.help.noHelp; + }, + load: function () { + var me = this; + epgd.ajax({
+ url: epgd.tr.pages.help.url, async: false, dataType: "html", contentType: "text/plain; charset=utf-8"
+ }, function (data) {
+ me.$con = $($(data).filter('#help')[0]);
+ $(data).filter('#help_js').appendTo(document.body);
+ }); + } +}; diff --git a/http/src/js/pages.login.js b/http/src/js/pages.login.js new file mode 100644 index 0000000..c751d49 --- /dev/null +++ b/http/src/js/pages.login.js @@ -0,0 +1,114 @@ +epgd.pages.login = { + useCookie: document.cookie.match(/login=([^;]+)/), + render: function () { + if (epgd.login.session) + this.doLogin('logout'); + this.showForm(); + }, + showForm: function(callback){ + var tr = epgd.tr.pages.login, + $con = $('#login'); + if (!$con.length) { + $con = $('<div id="login" title="' + tr.label + '" class="searchDialog ui-dialog" style="margin:5% auto"><form class="ui-dialog-content ui-widget-content"><table cellpadding="5">' + + '<tr><td>' + tr.userName + '</td><td><input type="text" id="lUser" /></td></tr>' + + '<tr><td>' + tr.password + '</td><td><input type="password" id="lPass" /></td></tr>' + + '<tr><td colspan="2"><input type="checkbox" id="lAlways" /> <label for="lAlways">' + tr.loggedAlwaysIn + '</label></td></tr>' + + '</table></form></div>'); + $con.dialog({ + modal: true, width: "auto", + closeOnEscape: false, + buttons: [{ + text: tr.label, + icons: {primary: "ui-icon-unlocked"}, + click: function () { + var form = $con.find('form')[0]; + if (!form.lUser.value) + return !!epgd.utils.topInfo(epgd.tr.error.emptyField.replace('$field$', tr.userName), { isError: 1 }); + $(this).dialog("close"); + epgd.pages.login.useCookie = form.lAlways.checked ? [] : null; + epgd.pages.login.doLogin(form.lUser.value, form.lPass.value, callback); + } + }] + }).keypress(function (e) { + if (e.keyCode == 13) { + $(this).parent().find(".ui-dialog-buttonpane button:eq(0)").trigger("click"); + } + }).parent().find('.ui-dialog-titlebar-close').remove(); + } else + $con.dialog('open'); + }, + doLogin: function (user, pass, callback) { + var curLogin = epgd.login, + uKey = '', + storage = sessionStorage; + + try {
+ storage.setItem('_storagetest_', 1);
+ storage.removeItem('_storagetest_');
+ } catch (ex) {
+ storage = { removeItem: function () { }, setItem: function () { }, getItem: function () { return null; } }
+ }
+ + function trigger_changed() { + if (epgd.login.user != curLogin.user || epgd.login.rights != curLogin.rights) { + if (!epgd.login.session) { + if (epgd.pages.login.useCookie) { + epgd.pages.login.useCookie[1] = null; + document.cookie = "login=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; + } + storage.removeItem('login'); + epgd.login.url = ''; + } else { + if (epgd.pages.login.useCookie) { + epgd.pages.login.useCookie[1] = uKey; + var d = new Date(); + d.setTime(d.getTime() + 365 * 24 * 60 * 60 * 1000); + document.cookie = "login=" + uKey + "; expires=" + d.toUTCString(); + } + storage.setItem('login', uKey); + epgd.login.url = 'sid' + epgd.login.session + '/'; + } + $(window).trigger("login_changed", curLogin); + } + epgd.login.url = epgd.login.session ? 'sid' + epgd.login.session + '/' : ''; + if ($.isFunction(callback)) + callback(); + } + + if (user != 'logout') { + if (curLogin.session) { + $.ajax({ url: curLogin.url + "data/login", data: JSON.stringify({ key: '' }), type: 'post', contentType: "application/json; charset=utf-8", dataType: 'json' }); + epgd.login.url = ''; + } + if (epgd.profile.needLogin == "0") { + epgd.login = { user: '', session: '', rights: 4294967295, url: '' }; + return trigger_changed(); + } + if (user) + uKey = YaMD5.hashStr(user + pass); + else { + uKey = storage.getItem('login'); + if (!uKey && epgd.pages.login.useCookie) + uKey = epgd.pages.login.useCookie[1]; + if (!uKey) + return this.showForm(callback); + } + } + $.ajax({ url: epgd.login.url + "data/login", data: JSON.stringify({ key: uKey }), type: 'post', contentType: "application/json; charset=utf-8", dataType: 'json' }).done(function (data) { + var tr = epgd.tr.pages.login; + epgd.login = data.login || { user: '', session: '', rights: 0, url: '' }; + if (!epgd.login.session) { + if (user == 'logout') { + epgd.utils.topInfo(tr.logoutMessage); + } else + epgd.utils.topInfo(tr.error, { isError: 1 }); + $('#menu_login a').text(tr.label); + } else { + $('#menu_login a').text(epgd.login.user + ' ' + tr.logout); + if (location.hash == "#menu_login" || location.hash == "#") + location.hash = ""; + } + return trigger_changed(); + }); + } +}; diff --git a/http/src/js/pages.magazine.js b/http/src/js/pages.magazine.js new file mode 100644 index 0000000..f5769e2 --- /dev/null +++ b/http/src/js/pages.magazine.js @@ -0,0 +1,413 @@ +epgd.pages.magazine = { + startTime: null, + endTime: null, + $head: null, + $con: null, + list: [], + viewCnt: 0, + scrollStart:0, + timeLineL: null, + timeLineR: null, + qt:{}, + imgPath: epgd.profile.eventImgPath ? epgd.profile.eventImgPath + '?no=0&maxW=100&maxH=70&id=' : false, + init: function () { + //this.initQT(); + this.select = epgd.channels.selBox; + + $(window).bind('channels_load', function () { + var self= epgd.pages.magazine, + id; + if (!self.$head) + return; + self.$head.empty(); + for (id in self.list) + self.list[id].index = -1; + self._initChannels(); + for (id in self.list) + if (self.list[id].index == -1) { + self.preTime.removeChild(self.list[id].col); + delete self.list[id]; + }; + }); + }, + initQT: function () {
+ var qt = {};
+ epgd.profile.quickTimes.replace(/=([0-9]{1,2}):([0-9]{1,2})/g, function (a, h, m) {
+ qt[parseInt(h,10)] = '<p' + (m ? ' style="margin-top:' + (m * 2) + 'px"' : '') + '> </p>';
+ }); + this.qt= qt; + }, + _initChannels: function () { + var ch,i; + for (i = 0; i < this.select.length; i++) { + ch = this.list[this.select[i].value]; + if (!ch) { + ch = new epgd.pages.magazine.channel(this.select[i].value, i, $('<div class="ui-widget-content"/>')[0]); + this.list[ch.id] = ch; + } else { + ch.index = i; + } + this.preTime.appendChild(ch.col); + this.select[i].ch = ch; + this.$head.append('<div class="ui-widget-content ui-corner-top">' + epgd.channels.getHtml(ch.id) + '</div>') + } + this.$head.css('width',(208 * this.select.length + 55) + 'px'); + }, + _initWinBindings: function(){ + $(window) + .bind("epgd_close.pages_magazine", function () { + epgd.$dtPicker.hide(); + $(window).unbind(".pages_magazine"); + clearInterval(this.pages_magazine.timeInterval); + delete this.pages_magazine; + }) + .bind("resize.pages_magazine", function () { + var w = $(window).width(), + l = $(this).scrollLeft(); + this.pages_magazine.$nav.width(w + 'px'); + this.pages_magazine.$con.css('height', ($(window).height() - 10 - $('#magazine').offset().top) + 'px'); + this.pages_magazine.viewCnt = parseInt((w - 110) / 208, 10); + if (this.pages_magazine.viewCnt < 5 ) { + this.pages_magazine.timeLineR.style.left = '-50px'; + this.pages_magazine.$con.css('width', (208 * this.pages_magazine.select.length + 25) + 'px'); + } else if (this.pages_magazine.viewCnt >= this.pages_magazine.select.length) { + this.pages_magazine.viewCnt = this.pages_magazine.select.length; + this.pages_magazine.timeLineR.style.left = '-50px'; + w = this.pages_magazine.viewCnt * 208 + 55; + this.pages_magazine.$con.css('width', (w -30) + 'px'); + } else { + this.pages_magazine.timeLineR.style.left = (l + w - 52) + 'px'; + this.pages_magazine.$con.css('width', (208 * this.pages_magazine.select.length + 150) + 'px'); + } + this.pages_magazine.lineNow.style.width = (w - 10) + 'px'; + epgd.$menu.parent().offset({ 'left': l }); + this.pages_magazine.$nav.offset({ 'left': l }); + this.pages_magazine.update(); + }) + .bind("scroll.pages_magazine", function () { + this.pages_magazine.timeLineL.style.left = '-50px'; + this.pages_magazine.timeLineR.style.left = '-50px'; + }) + .bind("scrollstop.pages_magazine", function () { + var l = $(this).scrollLeft(); + this.pages_magazine.timeLineL.style.left = this.pages_magazine.lineNow.style.left = l + 'px'; + if (this.pages_magazine.viewCnt >= 5 && this.pages_magazine.viewCnt < this.pages_magazine.select.length) + this.pages_magazine.timeLineR.style.left = (l + $(window).width() - 52) + 'px'; + this.pages_magazine.nextMain = parseInt((l + 104) / 208, 10); + if (this.pages_magazine.select.selectedIndex != this.pages_magazine.nextMain) + this.pages_magazine.setMain(0, this.pages_magazine.nextMain, true); + epgd.$menu.parent().offset({ 'left': l }); + this.pages_magazine.$nav.offset({ 'left': l }); + return false; + })
+ .bind("datepicker.pages_magazine", function () {
+ this.pages_magazine.setTime(epgd.utils.unixTime(epgd.$dtPicker.datetimepicker('getDate') || epgd.utils.now()), true); + })[0].pages_magazine = this; + + this.$con.bind('scrollstop.pages_magazine', function () { + var s = $(this).scrollTop(); + if (s > this.pages_magazine.scrollEnd) + this.pages_magazine.setTime(s * 30 + epgd.profile.minEventTime); + else if (s < this.pages_magazine.scrollStart) + this.pages_magazine.setTime(Math.max(this.pages_magazine.startTime - 43200, epgd.profile.minEventTime)); // 60 * 60 *12 + }); + + this._setLineNow(); + this.timeInterval = setInterval(this._setLineNow, 60000); + }, + _setLineNow: function(){ + var m = window.pages_magazine, + now = new Date().getTime() / 1000; + if (now > m.endTime || (m.startTime - epgd.profile.minEventTime) < -3600 ) { + $(window).trigger("epgd_close"); + $('<div class="ui-widget-overlay ui-front"></div>').click(function () { + epgd.profile.minEventTime = epgd.utils.now().getTime() / 1000 - 10800; + $(window).trigger("profile_updated", { "minEventTime": true }); + epgd.$dtPicker.datetimepicker('setDate', epgd.utils.now()); + m.$con.empty(); + m.render(); + $(this).remove(); + }).appendTo(document.body); + return; + } + m.lineNow.style.top = ((now - m.startTime) / 30 + m.scrollStart) + 'px'; + m.lineNow.innerHTML= epgd.utils.formatTime(now); + }, + render: function (channel) { + $('#menu_magazine').addClass("menu-active").append(epgd.$dtPicker.show()); + var startTime = epgd.utils.unixTime(epgd.utils.now()), + d; + if (this.startTime && (this.startTime - epgd.profile.minEventTime) < -3600) { + this.startTime = null; + this.list = []; + } + if (!this.startTime) { + $(window).trigger("epgd_close"); + $(this.select).appendTo(epgd.$menu.find('#menu_magazine')).mousedown(function (ev) { + ev.stopPropagation(); + return true; + }).click(function (ev) { + return false; + }).change(function () { + epgd.pages.magazine.render($(this).val()); + }); + if (this.select.selectedIndex < 0) + this.select.selectedIndex = 0; + this.$nav= $('<div id="magazine-nav"><div class="ui-widget-content ui-corner-top left"><div class="ui-widget-content ui-corner-top"><span class="iAsButton i-left-dir"></span><span class="iAsButton i-rewind"></span></div></div>' + + '<div class="ui-widget-content ui-corner-top right"><div class="ui-widget-content ui-corner-top"><span class="iAsButton i-right-dir"></span><span class="iAsButton i-forward"></span></div></div></div>') + this.$head = $('<div id="magazine-head"></div>'); + this.$con = $('<div id="magazine"></div>'); + this.$con[0].pages_magazine = this; + this.preTime = $('<div style="height:' + parseInt((epgd.profile.maxEventTime - epgd.profile.minEventTime) / 30,10) + 'px"></div>').appendTo(this.$con)[0]; + this.timeLineL = $('<div class="ui-widget-content timeLine"></div>').appendTo(this.preTime)[0]; + this.timeLineR = $('<div class="ui-widget-content timeLine tlr"></div>').appendTo(this.preTime)[0]; + this.lineNow = $('<p class="timeNow"></p>').appendTo(this.preTime)[0]; + this._initChannels(); + this.startTime = startTime+3600; + d = new Date(this.startTime * 1000); + if (d.getMinutes() > 0) { + d.setMinutes(0); + this.startTime = d.getTime() / 1000; + } + this.endTime = this.startTime; + this.setTime(this.startTime-7200); + } + if (!window.pages_magazine) { + this._initWinBindings(); + epgd.$con.empty(); + this.$nav.appendTo(epgd.$con).bind("click", this.actionHead); + this.$head.appendTo(epgd.$con).bind('click', function (ev) {
+ if (ev.target.className == 'i-tv') + epgd.vdrs.current.switchChannel(ev.target.parentNode.id);
+ }); + this.$con.appendTo(epgd.$con).bind("click", this.actionCon).bind("touchend",this.actionConOpen); + if (!$.support.touch && epgd.profile.magazinePan > 0)
+ this._pan();
+ } + $(window).trigger("resize.pages_magazine"); + if (channel) + this.setChannel(channel); + if (startTime < this.startTime || startTime > this.endTime) + this.setTime(startTime); + this.$con.scrollTop((startTime - epgd.profile.minEventTime) / 30 - 15); + $(window).trigger("resize.pages_magazine"); + }, + _pan: function(){ + var pan = false,
+ tp = $('<div style="width:90%; height:35px; margin-top:15px; position:fixed;z-index:99;left:5%"></div>').prependTo(epgd.$con)[0],
+ bot = $('<div style="width:90%; height:35px; position:fixed;z-index:99;bottom:0;left:5%"></div>').appendTo(epgd.$con)[0];
+ this.timeLineL.pan = -1;
+ this.timeLineR.pan = 1;
+ tp.pan = epgd.profile.magazinePan * -30;
+ bot.pan = epgd.profile.magazinePan * 30;
+
+ window.tp = tp;
+ window.bp = bot;
+ window.p = pan;
+ $([this.timeLineL, this.timeLineR, tp, bot]).mouseover(function (ev) {
+ if (pan) return;
+ pan = this.pan;
+ window.setTimeout(function () {
+ if (pan) {
+ var checkPan = window.setInterval(function () {
+ if (!pan || !window.pages_magazine)
+ return window.clearInterval(checkPan);
+ if (pan < -1 || pan > 1)
+ window.pages_magazine.setTime((window.pages_magazine.$con.scrollTop() + 15) * 30 + epgd.profile.minEventTime + pan, true);
+ else
+ window.pages_magazine.setMain(pan);
+ }, (pan < -1 || pan > 1 ? 100 : 1200));
+ }
+ }, epgd.profile.magazinePanDelay);
+ }).mouseout(function () {
+ pan = false;
+ });
+ }, + setChannel: function (channel) { this.setMain(0, this.list[channel].index); }, + setMain: function (delta, baseIndex, dontScroll) { + var optList = this.select, + i = isNaN(baseIndex) ? optList.selectedIndex : baseIndex; + i += delta; + if (i < 0) + i = 0;//+= optList.length; + else if (i >= optList.length - this.viewCnt) + i = optList.length - this.viewCnt;// -= optList.length; + optList.selectedIndex = i; + this.update(); + !dontScroll && $(window).scrollLeft(i * 208); + }, + setTime: function (start, doScroll) { + var t, insHtml = '', + h, + newEndTime = start + 43200; //86400; //60 * 60 * 24 + if (start < this.startTime) { + do { + this.startTime -= 3600; + t = epgd.utils.formatTime(this.startTime); + h = parseInt(t, 10); + if (h % 4 == 0) //if (t == '00:00') + t += $.datepicker.formatDate('<br />D,<br />dd<br />MM<br />yy', new Date(this.startTime * 1000)) + insHtml = (this.qt[h] || '') + '<dfn>' + t + '</dfn>' + insHtml; + } while (this.startTime > start); + $(this.timeLineL).prepend(insHtml); + $(this.timeLineR).prepend(insHtml); + this.scrollStart = (this.startTime - epgd.profile.minEventTime) / 30; + if (this.scrollStart < 0) { + this.scrollStart = 0; + this._setLineNow(); + } + this.preTime.style.paddingTop = this.scrollStart + 'px'; + } + if (this.endTime < newEndTime) { + insHtml = ''; + newEndTime = Math.max(newEndTime, this.endTime + 43200); //60 * 60 * 12 + for (; this.endTime < newEndTime; this.endTime += 3600) { + t = epgd.utils.formatTime(this.endTime); + h = parseInt(t, 10); + if (h % 4 == 0) + t += $.datepicker.formatDate('<br />D,<br />dd<br />M<br />yy', new Date(this.endTime * 1000)); + insHtml += (this.qt[h] || '') + '<dfn>' + t + '</dfn>'; + } + $(this.timeLineL).append(insHtml); + $(this.timeLineR).append(insHtml); + this.scrollEnd = (this.endTime - epgd.profile.minEventTime - 43200) / 30; // 60 * 60 *12 + } + insHtml && this.update(); + doScroll && this.$con.scrollTop((start - epgd.profile.minEventTime) / 30 - 15);
+ }, + actionHead: function (ev) { + var self = epgd.pages.magazine, + c; + if (ev.target.nodeName == 'SPAN') {
+ c = ev.target.className; + if (c.indexOf('i-left-dir') > -1) + self.setMain(-1); + else if (c.indexOf('i-rewind') > -1) + self.setMain(-self.viewCnt); + else if (c.indexOf('i-right-dir') > -1) + self.setMain(1); + else if (c.indexOf('i-forward') > -1) + self.setMain(self.viewCnt);
+ } + }, + actionConOpen: function (ev) { + var dt = $(ev.target).closest('dt')[0]; + if (dt) + dt.firstOpen = (dt.clientHeight != dt.scrollHeight); + }, + actionCon: function (ev) { + var dt = $(ev.target).closest('dt')[0]; + if (dt) { + if (dt.firstOpen) + return false; + if (!dt.eventDetail) + dt.eventDetail = new epgd.eventDetail(dt.title); + epgd.utils.loader.process(function () { + dt.eventDetail.render(); + }); + } + }, + update: function () { + var self = this, + i; + for (i = 0, j = this.select.selectedIndex; i < this.viewCnt && j < this.select.length; i++) + this.select[j++].ch.updateTime(); + window.setTimeout(function () { + for (var i = 0, j = self.select.selectedIndex + self.viewCnt; i < self.viewCnt && j < self.select.length; i++) + self.select[j++].ch.updateTime(); + }, 500); + } +}; + +epgd.pages.magazine.channel = function (id,index, col) { + this.id = id; + this.index = index; + this.col = col; + this.startTime; + this.endTime; +} +epgd.pages.magazine.channel.prototype = { + updateTime: function () { + if (!this.startTime) { + this.startTime = epgd.pages.magazine.startTime; + this.endTime = epgd.pages.magazine.endTime; + this.loadData(epgd.pages.magazine.startTime, epgd.pages.magazine.endTime); + } else { + if (epgd.pages.magazine.startTime < this.startTime) + this.loadData( epgd.pages.magazine.startTime, this.startTime); + if (epgd.pages.magazine.endTime > this.endTime) + this.loadData(this.endTime, epgd.pages.magazine.endTime); + } + }, + loadData: function (startTime, endTime) { + var self = this, + insAfter= (self.endTime < endTime); + if (insAfter) + self.endTime = endTime; + else + self.startTime = startTime; + epgd.ajax({ url: epgd.login.url + "data/events?time=" + startTime + '&endtime=' + endTime + '&channelid=' + this.id }, function (data) { + var insHtml = '', + first = data.events[0], + i, + event, + $dt= null, + $col = $(self.col), + desc,h,d, + eTime; + if (first) {
+ if (insAfter) {
+ $dt = $col.find('dt:last');
+ eTime = $dt[0].eTime;
+ if ($dt.attr('title') == first.id) + delete data.events[0];
+ } else {
+ eTime = first.starttime;
+ $dt = $col.find('dt:first');
+ if ($dt.attr('title') == data.events[data.events.length - 1].id) + delete data.events[data.events.length-1];
+ }
+ for (i = 0; i < data.events.length; i++) {
+ event = data.events[i];
+ desc = event.shortdescription || event.shorttext; + h = event.duration; + d = parseInt(h / 60, 10);/*, + fav = epgd.profile.fav ? ';border-color:' + epgd.profile.fav(event) : ''*/; + h += (event.starttime - eTime); + h = h < 600 ? 20 : parseInt(h / 30, 10); // 20px = 10 Minuten
+ eTime += h * 30; + insHtml += '<dt title="' + event.id + '" style="height:' + h + 'px;min-height:' + h + 'px">' //' + fav + ' + + '<div class="title">' + event.title + '</div>' + + (epgd.pages.magazine.imgPath && event.imagecount ? '<img src="' + epgd.pages.magazine.imgPath + event.id + '" />' : '') + + '<div class="time' + (event.timerid ? ' hasTimer' : '') + '"><u>' + epgd.utils.formatTime(event.starttime) + '</u><i>' + d + ' ' + epgd.tr.minutes + '</i></div>' + + (event.numrating ? '<span class="rate rate' + event.numrating + '"> </span>' : '') + + (event.tipp ? '<b class="tipp">' + event.tipp + '</b>' : '') + + '<div class="desc">' + (event.genre ? '<span>' + event.genre + '</span> ' : '') + (desc ? desc.replace(/\n/g, '<br />') : '') + + '</div></dt>';
+ };
+ } else { + h = (endTime - startTime) / 30; + insHtml = '<div style="height:' + h + 'px;min-height:' + h + 'px"></div>'; + first = { starttime: startTime }; + eTime = startTime; + } + if (insAfter) { + $col.append(insHtml); + $col.find('dt:last')[0].eTime = eTime; + } else { + $col.prepend(insHtml); + if ($dt && $dt.length) {
+ $dt.css('margin-top', '');
+ h = $dt[0].starttime - eTime; + if (h) {
+ h = parseInt(h/30,10) + parseInt($dt.css('min-height'), 10);
+ $dt.css({ "height": h + 'px', "min-height": h + 'px' })
+ }
+ } else + $col.find('dt:last')[0].eTime = eTime; + $col.find('dt:first').css('margin-top', parseInt((first.starttime - startTime) / 30, 10))[0].starttime= first; + } + //self.html = $(col).html(); + }); + } +}; diff --git a/http/src/js/pages.now.js b/http/src/js/pages.now.js new file mode 100644 index 0000000..8244f33 --- /dev/null +++ b/http/src/js/pages.now.js @@ -0,0 +1,135 @@ +epgd.pages.now = { + $ul: null, + timestamp_min: -1, + timestamp_max: 0, + timestamp_cur: 0, + + init: function () { + $(window).bind('channels_load', function () { epgd.pages.timestamp_max = 0; }); + }, + render: function () { + //this.renderTime = new Date().getTime();
+ if (!window.pages_now) {
+ this.$search = $('<div style="float:left;margin-left:5px"></div>').appendTo($('#menu_now')).click(function () {
+ if (this.curType == '@Now')
+ window.pages_now.setTime(null,'@Now');
+ }); + var $searchMenu = this.$searchMenu = $('<ul class="ui-menu ui-widget ui-widget-content"></ul>').appendTo($('#menu_now')).hide(); + epgd.profile.quickTimes && epgd.profile.quickTimes.replace(/([^=]+)=!?([^~]+)~?/g, function (a, l, v) {
+ $searchMenu.append('<li data-type="' + v + '" class="ui-menu-item ' + (v.indexOf('@') == 0 && v != '@Next' && v != '@Now' ? 'i-search' : 'i-clock') + '">' + l + '</li>');
+ });
+ if (!$searchMenu.find('li[data-type="@Next"]').length)
+ $searchMenu.prepend('<li data-type="@Next" class="ui-menu-item">' + epgd.tr.pages.eventDetail.eventNext + '</li>');
+ if (!$searchMenu.find('li[data-type="@Now"]').length)
+ $searchMenu.prepend('<li data-type="@Now" class="ui-menu-item">' + epgd.tr.pages.dateTimePicker.currentText + '</li>');
+ this.$searchMenu.click(function (ev) {
+ if (ev.target.getAttribute('data-type')) {
+ window.pages_now.setTime(null, ev.target.getAttribute('data-type'));
+ $searchMenu.hide();
+ }
+ });
+ $(window).bind("epgd_close.pages_now", function () {
+ if (window.pages_now) {
+ epgd.$dtPicker.hide(); + window.pages_now.$searchMenu.remove(); + window.pages_now.$search.remove(); + delete window.pages_now;
+ }
+ $(window).unbind(".pages_now");
+ $('#menu_now').unbind(".pages_now");
+ }).bind("datepicker.pages_now", function () {
+ this.pages_now.setTime(epgd.utils.unixTime(epgd.$dtPicker.datetimepicker('getDate')));
+ })[0].pages_now = this;
+ this.$ul = epgd.$con.html('<div id="pageNow"><ul class="teaserList"></ul></div>').find('ul')
+ .click(function (ev) {
+ if ($(ev.target).closest('.channel').length) {
+ $(window).trigger("epgd_close.eventDetail"); + if (ev.target.className == 'i-tv') + epgd.vdrs.current.switchChannel(ev.target.parentNode.id); + else {
+ epgd.$menu.menu("select", { target: "#menu_magazine" });
+ epgd.pages.magazine.setChannel(ev.target.parentNode.id);
+ } + return;
+ } + var li = $(ev.target).closest('li')[0]; + if (!li) return; + if (!li.eventDetail) + li.eventDetail = new epgd.eventDetail(li.title); + epgd.utils.loader.process(function () {
+ li.eventDetail.render();
+ });
+ });
+ this.setTime(null, '@Now');
+ }; + $('#menu_now').addClass("menu-active").bind("click.pages_now", function (ev) {
+ if ((ev.target == this || ev.target.nodeName == 'A') && window.pages_now) {
+ window.pages_now.$searchMenu.show();
+ ev.preventDefault();
+ }
+ return false;
+ }).append(epgd.$dtPicker.show());
+ }, + setTime: function (start, type) { + type = type || '@time'; + var at = ' ' + epgd.tr.pages.now.at; + if (type == '@Now' || type == '@time') {
+ this.timestamp_cur = start || epgd.utils.unixTime(epgd.utils.now());
+ this.load("data/events?time=" + this.timestamp_cur);
+ epgd.$dtPicker.datetimepicker('setDate', epgd.utils.date(this.timestamp_cur));
+ } else if (type == '@Next')
+ this.load("data/events?next=1&time=" + this.timestamp_cur);
+ else if (type[0] == '@') {
+ at = ' ' + epgd.tr.menu.search;
+ this.load("data/search", 'post', JSON.stringify({ autotimername: type.slice(1) }));
+ } else {
+ $.timepicker.quicklink({ target: { nodeName: 'U', innerHTML: type }, data: { unit: 'time' } });
+ $(window).trigger('datepicker');
+ } + this.$search[0].curType = type; + this.$search.text(this.$searchMenu.find('li[data-type="' + type + '"]').text() + at); + }, + load: function (url,type,data) {
+ epgd.utils.loader.process(function () {
+ pages_now.$ul.empty(); + epgd.ajax({ url: epgd.login.url + url, async: false, cache: false, type:type,data:data }, function (data) {
+ if (!data.events || !data.events.length) {
+ epgd.utils.loader.close(); + return epgd.utils.popup(epgd.tr.error.noData);
+ } + var imgPath = epgd.profile.eventImgPath ? epgd.profile.eventImgPath + '?no=0&maxW=100&maxH=70&id=' : false, + min = 0, + max = 2000000000, + dFormat = epgd.tr.dateTimePicker.dateFormat.replace(/\.?y+/,''); + now = parseInt(epgd.utils.now().getTime() / 1000, 10); + //maxHeight = 0, + $.each(data.events, function (id, event) {
+ var end = event.starttime + event.duration, + progress = ((now - event.starttime) / event.duration * 100), + desc = event.shortdescription || event.shorttext; + if (event.starttime > min) min = event.starttime; + if (end < max) max = end; + $('<li title="' + event.id + '" class="ui-widget-content ui-corner-all">' + + epgd.channels.getHtml(event.channelid) + + '<div class="time' + (event.timerid ? ' hasTimer' : '') + '"><b>' + epgd.utils.formatTime(event.starttime) + + '</b> – ' + epgd.utils.formatTime(end) + ' ' + epgd.tr.oClock + + (event.tipp ? '<b class="tipp">' + event.tipp + '</b>' : '') + + '</div>' + + (progress > 0 && progress <= 100 ? '<div class="progress"><div style="width: ' + progress + '%"></div></div>' : '<div class="date">' + epgd.utils.formatDate(event.starttime, dFormat) + '</div>') + + '<div class="desc">' + + (imgPath && event.imagecount ? '<img src="' + imgPath + event.id + '" />' : '') + + '<div class="title">' + event.title + + (event.numrating ? '<span class="rate rate' + event.numrating + '"> </span>' : '') + + '</div>' + + (event.genre ? '<span>' + event.genre + '</span> ' : '') + (desc ? desc.replace(/\n/g, '<br />') : '') + + '</div>' + + '</li>').appendTo(pages_now.$ul);
+ }); + epgd.pages.now.timestamp_min = min; + epgd.pages.now.timestamp_max = max; + epgd.utils.loader.close();
+ });
+ }, true);
+ } + +}; diff --git a/http/src/js/pages.profile.js b/http/src/js/pages.profile.js new file mode 100644 index 0000000..87bbc1b --- /dev/null +++ b/http/src/js/pages.profile.js @@ -0,0 +1,251 @@ +epgd.pages.profile = { + render: function () { + var /*fav = '', + rules= epgd.profile.favCond.split('\n'); + for (var i = 0; i < rules.length; i++) { + var terms = rules[i].match(/if \((.+)\) return '([^']+)';$/); + if (terms) + fav += '<li style="border:2px solid ' + terms[2] + '"></li>'; + },*/ + startPage = epgd.profile.startPage.slice(5), + namingmodeOptions = '<option>' + epgd.tr.pages.timerList.namingModes.join('</option><option>') + '</option>', + html = '<form id="page_profile"><h3>Interface</h3><div><table>' + + '<tr><td>startpage</td><td><select id="startPage">' + + jQuery.map(epgd.tr.menu, function (value, key) { + return '<option value="menu_' + key + (startPage == key ? '" selected="selected">' : '">') + value + '</option>'; + }).join('') + '</select></td></tr>' + + '<tr><td>default VDR</td><td><select id="defaultVDRuuid">' + $('#menu_vdrs').find('select').html() + '</select></td></tr>' + + '<tr><td>datepicker first day</td><td><select id="pickerFirstDay"><option>' + epgd.tr.dateTimePicker.dayNames.join('</option><option>') + '</option></select></td></tr>' + + '<tr><td>quicklinks</td><td><textarea rows="5" style="float:left;width:50%; margin-right:10px" id="quickTimes" onchange="epgd.pages.profile.validate.quickTimes(this)">' + epgd.profile.quickTimes.replace(/~/g, '\n') + '</textarea><span>enter in each line label=hh:mm(24h), eg:<br />prime time=20:15 or prime time=!20:15 (this time will not be highlighted in magazine)<br />now=@Now or next=@Next<br />tip=@searchtimerName</span></td></tr>' + + '<tr><td>constabel-login</td><td><input type="text" class="full" id="constabelLoginPath" value="' + (epgd.profile.constabelLoginPath || '') + '" />' + + '<br />e.g.https://www.eplists.de/eplist.cgi?action=login&login=[username]&secret=[password]</td></tr>' + + '<tr><td>' + epgd.tr.pages.profile.maxListEntries + '</td><td><input type="text" id="maxListEntries" value="' + epgd.profile.maxListEntries + '" data-valexp="^[1-9]{0,3}$" /></td></tr>' + + '<tr><th colspan="2">' + epgd.tr.menu.magazine + '</th><tr>' + + '<tr><td>' + epgd.tr.pages.profile.magazinePan + '</td><td><input type="text" id="magazinePan" value="' + epgd.profile.magazinePan + '" data-valexp="^[0-9]{1,2}$" /></td></tr>' + + '<tr><td>' + epgd.tr.pages.profile.magazinePanDelay + '</td><td><input type="text" id="magazinePanDelay" value="' + epgd.profile.magazinePanDelay + '" data-valexp="^[1-9][0-9]{2,3}$" /></td></tr>' + + '<tr><th colspan="2">' + epgd.tr.pages.timer.timerList + '</th><tr>' + + '<tr><td>' + epgd.tr.pages.timerList.namingMode + '</td><td><b>' + epgd.tr.pages.eventDetail.scrapperSerieInfo + '</b><div>' + + epgd.tr.pages.timer.timerList + ': <select id="namingModeSerie">' + namingmodeOptions + '</select><input id="namingModeSerieTemplate" value="' + epgd.profile.namingModeSearchSerieTemplate + '" type="text" style="width:90%" /></div><div>' + + epgd.tr.pages.timer.searchTimerList + ': <select id="namingModeSearchSerie">' + namingmodeOptions + '</select><input id="namingModeSearchSerieTemplate" value="' + epgd.profile.namingModeSearchSerieTemplate + '" type="text" style="width:90%" /></div><b style="text-decoration:line-through">' + + epgd.tr.pages.eventDetail.scrapperSerieInfo + '</b><div>' + + epgd.tr.pages.timer.timerList + ': <select id="namingModeMovie">' + namingmodeOptions + '</select><input id="namingModeMovieTemplate" value="' + epgd.profile.namingModeMovieTemplate + '" type="text" style="width:90%" /></div><div>' + + epgd.tr.pages.timer.searchTimerList + ': <select id="namingModeSearchMovie">' + namingmodeOptions + '</select><input id="namingModeSearchMovieTemplate" value="' + epgd.profile.namingModeSearchMovieTemplate + '" type="text" style="width:90%" /></div></td></tr>' + + '<tr><td>' + epgd.tr.pages.timerList.chFormat + '</td><td><input id="chFormat" readonly onclick="epgd.timerEditChFormat(this)" value="' + epgd.profile.chFormat + '" /></td></tr>' + + '<tr><td>VDR</td><td><select id="timerDefaultVDRuuid"><option value="">Auto</option>' + $('#menu_vdrs').find('select').html() + '</select></td></tr>' + + '<tr><td>' + epgd.tr.pages.profile.mailReceiver + '</td><td><input type="mail" value="' + (epgd.profile.mailReceiver || '') + '" id="mailReceiver" /><button onclick="epgd.utils.sendMail(\'checkMailAddress\',\'it works\',\'\',$(form.mailReceiver).val())">' + epgd.tr.test + '</button></td></tr>' + + '<tr><td>' + epgd.tr.pages.profile.sendMessages + '</td><td>' + + jQuery.map(epgd.tr.pages.timerList.messageTypes, function (value, key) { + return '<input type="checkbox" value="' + key + '" name="messageMailTypes"' + (epgd.profile.messageMailTypes.indexOf(key) >= 0 ? ' checked="checked"' : '') + ' />' + value; + }).join(' ') + + '</td></tr>' + + '<tr><th colspan="2">' + epgd.tr.menu.search + '</th><tr>' + + '<tr><td>' + epgd.tr.advanced + '</td><td><input type="checkbox" id="searchAdv" /></td></tr>' + + '<tr><th colspan="2">VDR OSD</th><tr>' + + '<tr><td>' + epgd.tr.pages.profile.vdr.startWithSched + '</td><td><input type="checkbox" id="startWithSched"' + (epgd.profile.startWithSched == "1" ? ' checked="checked"' : '') + ' /></td></tr>' + + '<tr><th colspan="2">' + epgd.tr.menu.records + '</th><tr>' + + '<tr><td>' + epgd.tr.pages.profile.record.subFolderSort + '</td><td><select id="recordSubFolderSort"><option value="1">' + epgd.tr.pages.eventDetail.title + ' up</option><option value="2">' + epgd.tr.pages.eventDetail.title + ' down</option><option value="3">' + epgd.tr.pages.timerList.folder + ' up</option><option value="4">' + epgd.tr.pages.timerList.folder + ' down</option><option value="5">' + epgd.tr.pages.timerList.recordTime + ' up</option><option value="6">' + epgd.tr.pages.timerList.recordTime + ' down</option></select></td></tr>' + + '</table></div>'; + if ((epgd.login.rights & epgd.rights.umConfigEdit) == epgd.rights.umConfigEdit) + html += '<h3>System</h3><div></div>'; + epgd.$con.html(html + '</form>' + + '<br /><input type="button" value="' + epgd.tr.save + '" onclick="epgd.pages.profile.save()" class="ui-button ui-widget ui-state-default ui-corner-all">'); + this.form= $( "#page_profile" ).tooltip().accordion({ + headers: "<h3>", + collapsible: true, + heightStyle: "content", + activate: function (event, ui) { + var panel = ui.newPanel[0]; + if (panel && !panel.hasLoaded) { + panel.hasLoaded = true; + if (ui.newHeader.text() == "System") { + $(panel).html('<table>' + + '<tr><th colspan="2">' + epgd.tr.pages.login.label + '</th></tr>' + + '<tr><td>' + epgd.tr.pages.login.needLogin + '</td><td><input type="checkbox" id="needLogin" /></td></tr>' + + '</table>') + .find("#needLogin").click(function () { + if (this.checked && !this.hasUsers) { + this.checked = false; + var elem = this; + epgd.ajax({ url: epgd.login.url + "data/users", cache:false }, function (data) { + var u = null, + $dialog, + uName; + for (uName in data.users) { u = data.users[uName]; if (u.active) return (elem.hasUsers = elem.checked = true) }; + $dialog = $('<form title="' + epgd.tr.pages.editUser.user + ' ' + (u ? u.user : epgd.tr.pages.editUser.add) + '"></form>'); + epgd.pages.editUser.showUser(u, $dialog, function () { + $dialog.dialog("close"); + if (!u) + elem.hasUsers = elem.checked = true; + else + $(elem).click(); + }); + $dialog.dialog({ modal: true, width: "auto" }); + }); + } + }).prop('checked', epgd.profile.needLogin == "1"); + epgd.ajax({ url: epgd.login.url + "data/parameters", async: true, cache: false, dataType: "json" }, function (data) { + var html = '', i, p, val, + tr = epgd.tr.pages.profile.system, + ptTime = 1, ptBool = 2; // ptNum = 0, , ptAscii = 3 + for (i in data.parameters) { + p = data.parameters[i]; + if (p.owner == 'epgd') { + html += '<tr><td>' + (tr[p.name] || p.name) + '</td><td>'; + val = typeof p.value == "undefined" ? p["default"] : p.value; + if (p.type == ptTime) + val= epgd.utils.formatDateTime(val); + if (p.readonly) + html += val; + else { + html += '<input data-value="' + val + '" data-valexp="' + (p.valexp || '') + '" id="' + p.name + '"'; + if (p.type == ptBool) + html += ' type="checkbox"' + (val == "1" ? ' checked' : ''); + else + html += ' type="text" class="full" value="' + val + '"'; + html += ' /></td></tr>'; + } + } + } + html && $(panel).find('table').append('<tbody id="pSystem"><tr><th>' + tr.label + '</th><th style="min-width:300px"></th></tr>' + html + '</tbody>') //&& $( "#page_profile" ).accordion('refresh'); + }); + } + } + } + })[0]; + this.form.namingModeSerie.selectedIndex = epgd.profile.namingModeSerie; + this.form.namingModeSearchSerie.selectedIndex = epgd.profile.namingModeSearchSerie; + this.form.namingModeMovie.selectedIndex = epgd.profile.namingModeMovie; + this.form.namingModeSearchMovie.selectedIndex = epgd.profile.namingModeSearchMovie; + + $([this.form.namingModeSerie,this.form.namingModeSearchSerie,this.form.namingModeMovie,this.form.namingModeSearchMovie] ).change(function () {
+ this.nextSibling.style.display = (this.selectedIndex == 6) ? 'block' : 'none';
+ }).change(); + epgd.utils.addPlaceholders(this.form.namingModeSerieTemplate, '%', epgd.tr.pages.timerList.templateFields); + epgd.utils.addPlaceholders(this.form.namingModeSearchSerieTemplate, '%', epgd.tr.pages.timerList.templateFields); + epgd.utils.addPlaceholders(this.form.namingModeMovieTemplate, '%', epgd.tr.pages.timerList.templateFields); + epgd.utils.addPlaceholders(this.form.namingModeSearchMovieTemplate, '%', epgd.tr.pages.timerList.templateFields); + + $(this.form.quickTimes).one("focus", function () {
+ var quickTimes = this;
+ epgd.ajax({ url: epgd.login.url + "data/searchtimers?type=S" }, function (data) {
+ var placeholders = { "@Now": ": current time", "@Next": ": next event" };
+ $.each(data.searchtimers, function (id, t) {
+ placeholders['@' + t.name || t.expression] = ': saved timer';
+ });
+ epgd.utils.addPlaceholders(quickTimes, '@', placeholders);
+ });
+ }); + + this.form.searchAdv.checked = epgd.profile.searchAdv == "1"; + epgd.profile.defaultVDRuuid && $(this.form.defaultVDRuuid).val(epgd.profile.defaultVDRuuid); + $(this.form.timerDefaultVDRuuid).val(epgd.profile.timerDefaultVDRuuid); + $(this.form.recordSubFolderSort).val(epgd.profile.recordSubFolderSort); + this.form.pickerFirstDay.selectedIndex= (epgd.profile.pickerFirstDay || epgd.tr.dateTimePicker.firstDay); + }, + save: function () { + var profile = epgd.profile, + data = [], + form = this.form, + owner= "@" + epgd.login.user, + panel; + function checkData(p) { + if (profile[p.name] != p.value) + data.push(p); + } + + if (!this.validate.quickTimes(form.quickTimes) + || !this.validate.checkRegex(form.magazinePan) + || !this.validate.checkRegex(form.magazinePanDelay)) + return false; + + checkData({ name: "defaultVDRuuid", value: $(form.defaultVDRuuid).val() || '', owner: owner }); + checkData({ name: "quickTimes", value: form.quickTimes.value.replace(/\n/g, '~'), owner: owner }); + checkData({ name: "startWithSched", value: $(form.startWithSched).prop('checked') ? "1" : "0", owner: owner }); + checkData({ name: "pickerFirstDay", value: new String(form.pickerFirstDay.selectedIndex), owner: owner }); + checkData({ name: "startPage", value: $(form.startPage).val() || '', owner: owner }); + checkData({ name: "namingModeSerie", value: new String(this.form.namingModeSerie.selectedIndex), owner: owner }); + checkData({ name: "namingModeSearchSerie", value: new String(this.form.namingModeSearchSerie.selectedIndex), owner: owner }); + checkData({ name: "namingModeMovie", value: new String(this.form.namingModeMovie.selectedIndex), owner: owner }); + checkData({ name: "namingModeSearchMovie", value: new String(this.form.namingModeSearchMovie.selectedIndex), owner: owner }); + checkData({ name: "namingModeSerieTemplate", value: new String(this.form.namingModeSerieTemplate.value), owner: owner }); + checkData({ name: "namingModeSearchSerieTemplate", value: new String(this.form.namingModeSearchSerieTemplate.value), owner: owner }); + checkData({ name: "namingModeMovieTemplate", value: new String(this.form.namingModeMovieTemplate.value), owner: owner }); + checkData({ name: "namingModeSearchMovieTemplate", value: new String(this.form.namingModeSearchMovieTemplate.value), owner: owner }); + checkData({ name: "timerDefaultVDRuuid", value: $(form.timerDefaultVDRuuid).val() || '', owner: owner }); + checkData({ name: "constabelLoginPath", value: $(form.constabelLoginPath).val() || '', owner: owner }); + checkData({ name: "chFormat", value: $(form.chFormat).val() || '', owner: owner }); + checkData({ name: "searchAdv", value: $(form.searchAdv).prop('checked') ? "1" : "0", owner: owner }); + checkData({ name: "messageMailTypes", value: $(form.messageMailTypes).map(function () { return this.checked ? this.value : "" }).toArray().join(''), owner: owner }); + checkData({ name: "mailReceiver", value: $(form.mailReceiver).val() || '', owner: owner }); + checkData({ name: "magazinePan", value: $(form.magazinePan).val() || '', owner: owner }); + checkData({ name: "magazinePanDelay", value: $(form.magazinePanDelay).val() || '', owner: owner }); + checkData({ name: "maxListEntries", value: $(form.maxListEntries).val() || '', owner: owner }); + checkData({ name: "recordSubFolderSort", value: $(form.recordSubFolderSort).val() || '1', owner: owner }); + + panel = $('#pSystem').parent().parent()[0]; + if (panel && panel.hasLoaded) { + checkData({ name: "needLogin", value: $(form.needLogin).prop('checked') ? "1" : "0", owner: "webif" }); + $('#pSystem input').each(function () { + if (this.type == 'checkbox') { + if (this.checked != (this.getAttribute('data-value') == "1")) + data.push({ name: this.id, value: (this.checked ? "1" : "0"), owner: "epgd", valexp: this.getAttribute('data-valexp')}); + } else if (this.getAttribute('data-value') != this.value) { + if (epgd.pages.profile.validate.checkRegex(this)) + data.push({ name: this.id, value: this.value, owner: "epgd" }); + else{ + data = []; + return false; + } + } + }); + } + if (data.length) { + if (panel) panel.hasLoaded = false; + panel = $("#page_profile").accordion("option", "active"); + $("#page_profile").accordion("option", "active", false).accordion("option", "active", panel); + epgd.ajax({ + url: epgd.login.url + 'data/save-parameters', + type: 'post', + data: JSON.stringify({ "parameters": data }) + }, function (res) { + res = res.result; + if (res && res.state == 200) + epgd.utils.topInfo(epgd.tr.dataSaved); + else + epgd.utils.topInfo(res.message, { isError: 1 }); + epgd.profile_load(); + }, function (jqxhr) { + try { + var msg = ''; + $(jqxhr.responseJSON.result.failed).each(function () { + msg += '<li>' + form[data[this].name].parentNode.previousSibling.innerHTML + '</li>'; + }); + if (msg) { + epgd.utils.popup('<ol>' + msg + '</ol>', { title: epgd.tr.error.invalid }); + return true; + } + } catch (e) { } + return false; + }); + } + }, + validate: { + quickTimes: function (input) { + input.value = input.value.replace(/\n{2,}/g, '\n').replace(/^\n+|\n+$/g, ''); + if (!/^(\n?[^=]+=!?(([0-1]?[0-9]|2[0-4]):[0-5]?[0-9]|@Now|@Next|@[A-Za-z0-9]*))*$/.test(input.value)) { + input.focus(); + epgd.utils.popup(epgd.tr.error.invalid); + return false; + } + return true; + }, + checkRegex: function (input) {
+ if (input.getAttribute('data-valexp') && !new RegExp(input.getAttribute('data-valexp')).test(input.value)) {
+ input.focus(); + epgd.utils.popup(epgd.tr.error.invalid); + return false;
+ }
+ return true;
+ } + } +}; diff --git a/http/src/js/pages.records.js b/http/src/js/pages.records.js new file mode 100644 index 0000000..640a27a --- /dev/null +++ b/http/src/js/pages.records.js @@ -0,0 +1,453 @@ +epgd.pages.records = { + render: function () {
+ if (!(epgd.login.rights & epgd.rights.umRecordings) == epgd.rights.umRecordings) return epgd.utils.popup(epgd.tr.error.forbidden, { title: epgd.tr.error.error }); + if (!epgd.profile.recordSubFolderSort)
+ epgd.profile.recordSubFolderSort = 1;
+ $('#menu_records').addClass("menu-active"); + var tr = epgd.tr.pages.records; + + if (!this.$bar) {
+ this.$bar = $('<div class="ui-widget ui-state-highlight ui-corner-all" style="padding:3px 10px">' + + '<button class="iAsButton i-trash" title="' + epgd.tr.del + '"/>' + + '<div id="recBar">' + + '<button class="iAsButton i-refresh" onclick="epgd.pages.records.update()">' + epgd.tr.reload + '</button>' + + epgd.pages.help.getIcon('recRefresh') + ' ' + + epgd.tr.pages.search.search + epgd.pages.help.getIcon('recSearch') + '<button class="iAsButton" onclick="this.checked = !this.checked; $(this).toggleClass(\'ui-state-highlight\', this.checked); epgd.pages.records.search();"> ∗</button>' + + '<input id="rSVal" type="text" onkeyup="epgd.pages.records.search(this.value)" />' + + '<button class="iAsButton" onclick="this.checked = !this.checked;$(this).toggleClass(\'ui-state-highlight\', this.checked); epgd.pages.records.search();">∗ </button>' + + '<span style="display:none">' + + '<button class="iAsButton i-rewind" onclick="epgd.pages.records.searchMove(1)"></button>' + + '<span id="rSCnt">0</span>' + + '<button class="iAsButton i-forward" onclick="epgd.pages.records.searchMove(-1)"></button>' + + '</span> <input type="checkbox" id="dragdrop"' + ($.support.touch ? '' : ' checked="checked"') + ' onchange="epgd.pages.records.dd(this.checked)" />' + + tr.ddLabel + epgd.pages.help.getIcon('recDD') + + '</div>' + +'</div>'); + this.$trash = this.$bar.find('.i-trash').droppable({
+ accept: ".rec",
+ hoverClass: "ui-state-hover",
+ tolerance: "pointer",
+ drop: function (ev, ui) {
+ var elem = ui.helper.context;
+ epgd.utils.confirm(epgd.tr.pages.records.deleteMessage.replace("$src$", elem.getAttribute('data-path')), function (ok) {
+ ok && epgd.pages.records.del(elem);
+ });
+ return false;
+ }
+ }).click(function () {
+ var $recs = $("#records").find('.rec.selected');
+ $recs.length && epgd.utils.confirm(epgd.tr.confirmDelete + ($recs.length > 1 ? '<br />' + $recs.length + epgd.tr.entries : ''), function (ok) {
+ ok && $recs.each(function () {
+ epgd.pages.records.del(this);
+ });
+ });
+ });
+ this.curSearch = {
+ pattern: '', searchValue: '', hits: $(), cur: 0, $count: this.$bar.find('#rSCnt')
+ , fromStart: this.$bar.find('#rSVal').prev('button')[0]
+ , toEnd: this.$bar.find('#rSVal').next('button')[0]
+ }
+ epgd.pages.help.initButtons(this.$bar);
+ } + this.$bar.insertAfter(epgd.$menu); + epgd.$menu.checkMenuSize(); + $(window).bind("epgd_close.records", function () {
+ epgd.pages.records.$bar.remove();
+ epgd.$menu.checkMenuSize();
+ $(window).unbind(".records");
+ }); + epgd.$con.html('<div id="records"></div>'); + epgd.utils.loader.process(function () {
+ epgd.ajax({ url: epgd.login.url + "data/recordings", cache: false }, function (data) {
+ var recs = data.recordings, + rec, key, paths, t, p, i, + tree = { f: {}, r: [] }, + vdrs = {}, + vdr, v, + html = '', + min = ' ' + epgd.tr.minutes, + $divs, + sortFunc = epgd.profile.recordSubFolderSort == 6 ? function (a, b) { return a.starttime > b.starttime ? -1 : 1 } + : epgd.profile.recordSubFolderSort == 5 ? function (a, b) { return a.starttime > b.starttime ? 1 : -1 } + : epgd.profile.recordSubFolderSort == 4 ? function (a, b) { return a.path > b.path ? -1 : 1 } + : epgd.profile.recordSubFolderSort == 3 ? function (a, b) { return a.path > b.path ? 1 : -1 } + : epgd.profile.recordSubFolderSort == 2 ? function (a, b) { return a.tit > b.tit ? -1 : 1 } + : function (a, b) { return a.tit > b.tit ? 1 : -1 }; + + for (vdr in epgd.vdrs.list) {
+ v = epgd.vdrs.list[vdr]; + if (!v.usecommonrecfolder) + vdrs[vdr] = { f: {}, r: [] }; + html += '<div>VDR - ' + v.name + ': ' + v.videodir + ' - ' + parseInt(v.videofree / 1000, 10) + ' GB ' + tr.available + ' / ' + parseInt(v.videototal / 1000, 10) + ' GB</div>';
+ } + if (!$('#dragdrop').parent().length) //.append(html) + return false; + epgd.$con.find('#records').before(html); + html = ''; + + for (i in recs) {
+ rec = recs[i]; + t = vdrs[rec.vdruuid] || tree; + paths = rec.path.split('/'); + paths.pop(); + for (p = 0; p < paths.length; p++) {
+ key = paths[p].replace(/_/g, ' '); + t = t.f[key] || (t.f[key] = { f: {}, r: [] });
+ } + t.r.push(rec);
+ } + + function checkTree(t) {
+ var hasContent = false, + subFolder, subTree; + t.cnt = 0; + for (subFolder in t.f) {
+ subTree = t.f[subFolder]; + if (subTree.r.length == 1) + t.r.push(subTree.r.pop()); + checkTree(subTree); + if (checkTree(subTree)) {
+ hasContent = true;
+ t.cnt += subTree.cnt;
+ } else + delete t.f[subFolder];
+ } + if (!hasContent) + delete t.f; + t.cnt += t.r.length; + return hasContent || t.r.length > 0;
+ } + + function renderTree(t) {
+ Object.keys(t.f).sort().forEach(function (subFolder) {
+ var subTree = t.f[subFolder], + i; + html += subFolder ? '<div class="folder"><h4><span class="i-folder-closed">(' + (subTree.cnt) + ')</span><m class="i-"/>' + subFolder + '</h4>' : '<div>'; + subTree.f && renderTree(subTree); + if (subTree.r.length) {
+ for (i in subTree.r) {
+ rec = subTree.r[i]; + rec.tit = ((rec.name != subFolder ? rec.name : '') + + (subFolder != rec.title && (rec.title != rec.name) ? '<br />' + rec.title : '') + + (rec.shorttext && (rec.shorttext != rec.name) ? '<i>' + rec.shorttext + '</i>' : '')) || subFolder; + rec.html = '<div class="rec" data-start="' + rec.starttime + '" data-owner="' + (rec.owner || '') + + '" data-md5="' + rec.md5path + '" data-path="' + rec.path + '">' + + '<em>' + epgd.utils.formatDateTime(rec.starttime) + '</em><u>' + parseInt(rec.duration / 60, 10) + min + '</u><b>' + + rec.tit + + '</b></div>';
+ };
+ subTree.r.sort(sortFunc);
+ for (i in subTree.r) { html += subTree.r[i].html; }
+ } + html += '</div>';
+ });
+ } + + p = {}; + if (checkTree(tree)) + p[tr.commonRecFolder] = tree; + for (vdr in vdrs) {
+ t = vdrs[vdr]; + if (checkTree(t)) {
+ p['VDR - ' + epgd.vdrs.list[vdr].name] = t;
+ }
+ } + renderTree({ f: p }); + + $divs = epgd.$con.find('#records').html(html); + if (!$divs.length)
+ return false;
+ $divs = $divs.click(epgd.pages.records.action).find('>div');
+ if ($divs.length == 1) + $divs.first().toggleClass('open');
+ epgd.pages.records.$menu = $('<ul class="ui-menu ui-widget ui-widget-content" style="position:absolute">' + + '<li class="ui-menu-item" data-type="title"><a class="iAsButton i-sort-name-up" data-sort="1"></a> <a class="iAsButton i-sort-name-down" data-sort="2"></a> ' + epgd.tr.pages.eventDetail.title + '</li>' + + '<li class="ui-menu-item" data-type="path"><a class="iAsButton i-sort-name-up" data-sort="3"></a> <a class="iAsButton i-sort-name-down" data-sort="4"></a> ' + epgd.tr.pages.timerList.folder + '</li>' + + '<li class="ui-menu-item" data-type="start"><a class="iAsButton i-sort-name-up" data-sort="5"></a> <a class="iAsButton i-sort-name-down" data-sort="6"></a> ' + epgd.tr.pages.timerList.recordTime + '</li>' + + '</ul>').hide().appendTo(epgd.$con);
+ $('#dragdrop').change();
+ epgd.pages.records.curSearch.$recs = null;
+ epgd.utils.loader.close();
+ });
+ },true);
+ }, + search: function (searchValue) {
+ var cs = this.curSearch,
+ sLength, + $recs, + pattern,
+ fromStart = cs.fromStart.checked,
+ toEnd = cs.toEnd.checked;
+
+ if (!cs.$recs)
+ cs.$recs= epgd.$con.find('#records .rec,h4');
+ if (typeof searchValue == "string")
+ cs.searchValue = searchValue.replace(/</g, '<').replace(/>/g, '>');
+
+ pattern = (fromStart ? '>' + cs.searchValue : cs.searchValue).toLowerCase() + (toEnd ? '<' : '');
+ if (pattern == cs.pattern)
+ return;
+ sLength = cs.searchValue.length;
+ $recs = cs.$recs;
+
+ if (cs.hits.length) {
+ $(cs.hits).each(function () {
+ this.innerHTML = this.innerHTML.replace(/<mark>([^<]+)<\/mark>/gi, '$1');
+ }).parents('.tmp-open').removeClass('tmp-open');
+ if (pattern.indexOf(cs.pattern) == 0)
+ $recs = $(cs.hits);
+ else
+ cs.cur = 0;
+ cs.hits = [];
+ } else
+ cs.cur = 0;
+ cs.pattern = pattern;
+ if (sLength > 2) {
+ $recs.each(function () {
+ var pos = this.innerHTML.toLowerCase().indexOf(pattern);
+ if (pos > 0) {
+ cs.hits.push(this)
+ $(this).parents('.folder').addClass('tmp-open');
+ do {
+ if (fromStart)
+ pos++;
+ this.innerHTML = this.innerHTML.slice(0, pos) + "<mark>" + cs.searchValue + "</mark>" + this.innerHTML.slice(pos + sLength);
+ } while ((pos = this.innerHTML.toLowerCase().indexOf(pattern, pos + 13)) > 0) // "<mark></mark>" = 13 Zeichen
+ }
+ });
+ cs.$count.text(cs.hits.length).parent().show();
+ this.searchMove(0);
+ } else
+ cs.$count.parent().hide();
+ }, + searchMove: function (dir) {
+ this.curSearch.cur += dir;
+ var n = this.curSearch.hits[this.curSearch.cur];
+ if (!n) {
+ this.curSearch.cur = dir < 0 ? this.curSearch.hits.length - 1 : 0;
+ n = this.curSearch.hits[this.curSearch.cur];
+ }
+ if (n) {
+ n.scrollIntoView(false);
+ $(n).css({ 'background-color': 'green' });
+ window.setTimeout(function () { $(n).css({ 'background-color': '' }); },1500);
+ }
+ }, + action: function (ev) {
+ var elem = ev.target; // aktueller Sortiebutton, bzw. inital jquery-elment + if (elem.nodeName == 'MARK') + elem = elem.parentNode; + if (elem.nodeName == 'M') {
+ epgd.pages.records.$menu.show().position({
+ my: "left top", + at: "left bottom", + of: elem
+ }).find('a').removeClass('ui-state-highlight');
+ epgd.pages.records.$menu.find('a[data-sort=' + (elem.curSort || epgd.profile.recordSubFolderSort) +']').addClass('ui-state-highlight');
+ $(document).one('click.recmenu', function (ev) {
+ if (ev.target.nodeName == 'A') {
+ var t = ev.target.parentNode.getAttribute('data-type');
+ if (t ){
+ elem.curSort= ev.target.getAttribute('data-sort');
+ epgd.pages.records.sort(elem.parentNode.parentNode, elem.curSort);
+ }
+ }
+ epgd.pages.records.$menu.hide();
+ $(document).unbind('.recmenu');
+ }).bind("keyup.recmenu", function (e) {
+ if (e.keyCode == 27) + $(document).trigger("click.recmenu");
+ });
+ return false;
+ } + + if (elem.nodeName == 'I' || elem.nodeName == 'SPAN') + elem = elem.parentNode; + if (elem.nodeName == 'B') {
+ elem = elem.parentNode; + if (!elem.recDetail) + elem.recDetail = new epgd.recordDetail(elem); + epgd.utils.loader.process(function () {
+ elem.recDetail.render();
+ });
+ } else if (elem.nodeName == 'H4') {
+ elem = elem.parentNode; + if (elem.nodeName == 'DIV' && elem.className.indexOf('folder') >= 0) {
+ if (elem.className.indexOf('open') == -1) {
+ if ($(window).width() < 500) {
+ $(elem).siblings('.open').removeClass('open');
+ document.body.scrollTop = $(elem).offset().top - 35;
+ }
+ $(elem).addClass('open');
+
+ } else
+ $(elem).removeClass('open');
+ }
+ } else
+ $(elem).closest('.rec').toggleClass('selected');
+ }, + dd: function (enable) {
+ var $records = $("#records"),
+ $recs = $records.find('.rec').has('.ui-draggable');
+ if (enable && $recs.length == 0) {
+ $records.find("h4").droppable(this.__dropSettings);
+ $recs.end().draggable({
+ cancle: "b",
+ revert: "invalid",
+ distance: 15,
+ helper: function () {
+ return $(this).clone().css("display", "block");
+ },
+ appendTo: 'body',
+ cursor: 'pointer',
+ cursorAt: { left: -15, top: 5 },
+ start: function (ev, ui) {
+ $(document).trigger("click.recmenu");
+ $(document.body).addClass('dd-open');
+ document.body.style.paddingTop = epgd.pages.records.$bar.height() + 'px';
+ document.body.scrollTop -= ev.pageY - $(ev.delegateTarget).closest('.folder').offset().top;
+ /*$(document).bind("keyup.dd", [this], function (ev) {
+ if (ev.keyCode == 27) + $.ui.ddmanager.dragStop($(ev.data[0]).draggable("instance"), ev); //$(ev.data[0]).draggable("cancel");
+ }); */
+ },
+ stop: function (ev, ui) {
+ // $(document).unbind(".dd");
+ $(document.body).removeClass('dd-open');
+ epgd.$menu.checkMenuSize();
+ }
+ });
+ } else if ($recs.length){
+ $recs.draggable(enable ? "enable" : "disable");
+ }
+ }, + __dropSettings: {
+ accept: ".rec",
+ hoverClass: "ui-state-hover",
+ tolerance: 'pointer',
+ drop: function (ev, ui) {
+ console.log("Dropped!", ev, ui);
+ var $elem = $(ev.target), + path = ''; + do {
+ path = $elem.text().replace(/^\(.*\)/,'') + '/' + path;
+ $elem = $elem.parent();
+ } while (($elem = $elem.prevAll('h4')).length); + epgd.pages.records.move(ui.draggable.context, path.slice(path.indexOf('/', 2) + 1).replace(/ /g, '_'),ev.target.parentNode)
+ return false; + }
+ }, + update: function () { + epgd.ajax({ url: epgd.login.url + "data/updaterecordings" }, function (data) { + epgd.utils.topInfo(epgd.tr.pages.records.refreshMessage.replace('$sec$', 5), { autoClose: 5000 }); + $(window).trigger("epgd_close.records"); + window.setTimeout(function () { epgd.pages.records.render(); }, 5000); + }); + }, + move: function (elem, path, folder) { + var curPath = elem.getAttribute('data-path').split('/'), + name = curPath.pop(), // 2016-08-21.11.18.59-0.rec entfernen + i, + endPos= 0; + curPath = curPath.join('/') + '/'; + for (i = 0; i < Math.min(path.length, curPath.length) && path[i] == curPath[i]; i++) {
+ if (path[i] == '/')
+ endPos= i;
+ } + curPath = window.prompt(epgd.tr.pages.records.moveMessage.replace("$src$", curPath), path.concat(curPath.slice(endPos)).replace(/\/{2,}/g, '/').replace(/\/$/, '')); + if (curPath) { + epgd.ajax({ url: epgd.login.url + 'data/renamerecording?starttime=' + elem.getAttribute('data-start') + '&md5path=' + elem.getAttribute('data-md5') + '&owner=' + elem.getAttribute('data-owner') + '&name=' + curPath.replace(/\//g, '~'), async: true }, function (data) { + data = data.result; + if (data && data.state == 200) {
+ var $elem = $(elem),
+ $counter = $elem.prevAll('h4').find('span'),
+ $folder= $(folder),
+ newPath = curPath.split('/'), i;
+ $elem.attr('data-path', curPath + '/' + name);
+ $elem.attr('data-md5', "").draggable("disable").addClass("ui-state-disabled");
+ newPath.shift(); //erster Ordner ist ja == folder
+ $elem.parents('.folder:not(:last)').find('>h4>span').each(function () {
+ this.innerHTML = '(' + (parseInt(this.innerHTML.slice(1, -1), 10) - 1) + ')';
+ });
+ $counter = $folder.find('span');
+ $counter.text('(' + (parseInt($counter.text().slice(1, -1), 10) + 1) + ')');
+ for (i = 0; i < newPath.length; i++) {
+ if ($folder.find('>.folder>h4').each(function () {
+ if (this.lastChild.nodeValue == newPath[i]) {
+ $folder = $(this.parentNode);
+ $counter = $folder.find('span');
+ $counter.text('(' + (parseInt($counter.text().slice(1, -1), 10) + 1) + ')');
+ return true;
+ } else
+ return false;
+ }).length == 0) {
+ for (; i < newPath.length; i++) {
+ $folder = $('<h4><span class="i-folder-closed">(1)</span><m class="i-"/>' + newPath[i] + '</h4></div>').droppable(epgd.pages.records.__dropSettings).wrap('<div class="folder open"></div>').parent().appendTo($folder);
+ }
+ };
+ }
+ $elem.appendTo($folder);
+ epgd.pages.records.sort(folder);
+ epgd.utils.topInfo(epgd.tr.dataSaved);
+ epgd.pages.records.__updateRec(elem);
+ } + else {
+ epgd.utils.topInfo(data.message, { isError: 1 }); + return false;
+ } + }); + } + return !!curPath; + }, + __updateRec: function (elem, cnt) {
+ epgd.ajax({ url: epgd.login.url + 'data/recording?starttime=' + elem.getAttribute('data-start') + '&path=' + elem.getAttribute('data-path') + '&owner=' + elem.getAttribute('data-owner') + '&'+cnt, async: true }, function (data) {
+ $(elem).attr('data-md5', data.recording.md5path).draggable("enable").removeClass("ui-state-disabled");
+ }, function (jqxhr, e) {
+ if (!cnt)
+ cnt = 0;
+ else if (cnt >= 5)
+ return epgd.utils.popup(epgd.tr.pages.records.notFoundMessage, { title: epgd.tr.error.error });
+
+ window.setTimeout(epgd.pages.records.__updateRec, 3000,elem,++cnt);
+ return true;
+ });
+ }, + del: function (elem) {
+ epgd.ajax({ url: epgd.login.url + 'data/deleterecording?starttime=' + elem.getAttribute('data-start') + '&md5path=' + elem.getAttribute('data-md5') + '&owner=' + elem.getAttribute('data-owner'), async: true }, function (data) {
+ data = data.result; + if (data && data.state == 200) {
+ epgd.utils.topInfo(elem.getAttribute('data-path') + '<br />' + epgd.tr.dataSaved); + $(elem).parents('.folder:not(:last)').find('>h4>span').each(function () {
+ this.innerHTML = '(' + (parseInt(this.innerHTML.slice(1, -1), 10) - 1) + ')';
+ }); + $(elem).remove(); + } else + epgd.utils.topInfo(elem.getAttribute('data-path') + '<br />' + data.message, { isError: 1 });
+ }); + }, + sort: function (con, sort) {
+ var $elems = $(con).find('>div.rec'),
+ dir = sort % 2 ? 1 : -1,
+ t;
+ if (!sort)
+ sort = $(">h4>m", con)[0].curSort || epgd.profile.recordSubFolderSort;
+ if (sort < 3)
+ $elems.sort(function (a, b) { return a.lastChild.innerHTML > b.lastChild.innerHTML ? dir : -dir }).appendTo(con);
+ else{
+ t= sort < 5 ? 'data-path' : 'data-start';
+ $elems.sort(function (a, b) { return a.getAttribute(t) > b.getAttribute(t) ? dir : -dir }).appendTo(con);
+ }
+ $(con).find('>div.folder').each(function () {
+ epgd.pages.records.sort(this, sort);
+ });
+ } +}; +/* +$.widget("ui.draggable", $.ui.draggable, {
+ _mouseStart: function (ev) {
+ if (this.options.beforeStart && this.options.beforeStart(ev) === false)
+ return false;
+ return this._super(ev);
+ }
+});
+*/
\ No newline at end of file diff --git a/http/src/js/pages.timer.js b/http/src/js/pages.timer.js new file mode 100644 index 0000000..44b1cd7 --- /dev/null +++ b/http/src/js/pages.timer.js @@ -0,0 +1,743 @@ +epgd.sortTable = function (options) { + this.o = $.extend({ + conSel: epgd.$con, + empty: '', + right: 1 + }, options); +} +epgd.sortTable.prototype = { + sortIcons: '<span class="iAsButton i-sort-name-down sort"></span><span class="iAsButton i-sort-name-up sort"></span>', + update: function () { }, + hideHead: function(){ + var $ths = this.$con.find('thead:first').hide().find('>tr>th'); + this.$con.find('tbody:first').html('<tr><td colspan="' + $ths.length + '">' + this.o.empty + + ($ths.last().find('.i-doc-new').wrapAll('<div />').parent().html() || '') + '</td></tr>'); + }, + showHead: function(){ + this.$con.find('>table>thead').show();
+ this.filter();
+ this.sort();
+ }, + getTable: function () { }, + action: function ($el, iconName, data) { + switch (iconName) { + case 'refresh': + this.update(); + break; + case 'detail': + if (!$el[0].eventDetail) + $el[0].eventDetail = new epgd.eventDetail(data); + epgd.utils.loader.process(function () { + $el[0].eventDetail.render(); + }); + break; + } + }, + render: function ($con, searchData) { + this.trs = []; + this.$con = $con || $(this.o.conSel); + this.$con.empty(); + if (!(epgd.login.rights & this.o.right) == this.o.right) return epgd.utils.popup(epgd.tr.error.forbidden, { title: epgd.tr.error.error }); + this.$con.html(this.getTable()); + this.init(); + this.update(searchData); + }, + init: function () {
+ var list = this, + cIndex = 0;
+ this.$con.find('>table').click(function (ev) {
+ var $el = $(ev.target), + el = $el[0], + data = el.getAttribute('data-evId'), + d, + $lastSel; + if (data) + list.action($el, 'detail', data); + else if (ev.target.className == 'i-tv') {
+ epgd.vdrs.current.switchChannel(ev.target.parentNode.id);
+ } else {
+ //if (!searchData || searchData.fromEventDetail != true) + // $(window).trigger("epgd_close.eventDetail"); + $el = $el.closest('span.sort'); + if ($el.length) {
+ $el.parent().parent().find('.ui-state-highlight').removeClass('ui-state-highlight'); + $el.addClass("ui-state-highlight"); + list.sort($el);
+ } else {
+ $el = $(el).closest('span.edit'); + if ($el.length) {
+ list.action($el, $el[0].className.match(/i-([a-z0-9-]+)/)[1]);
+ } if (list.o.selectable) {
+ if (el.nodeName == 'TD') {
+ $el = $(el).parent().toggleClass('selected'); + if (ev.shiftKey && this.lastSel) {
+ $lastSel = $(this.lastSel); + d = $el.index() - $lastSel.index(); + if (d > 0) + $lastSel.nextAll(':lt(' + d + '):visible').toggleClass('selected', $lastSel.hasClass('selected')); + else + $lastSel.prevAll(':lt(' + -d + '):visible').toggleClass('selected', $lastSel.hasClass('selected'));
+ } + else + this.lastSel = $el[0];
+ } else if (el.nodeName == 'B') {
+ d = el.getAttribute('data-t'); + $(list.trs).filter(":visible").toggleClass('selected', d == 1 ? true : d == 0 ? false : undefined); + return false;
+ }
+ }
+ } + return false;
+ }
+ }).find('>thead>tr').find('>th').each(function () {
+ this.cIndex = cIndex;
+ cIndex += this.colSpan;
+ }).end().find('[data-defaultSort="1"]>span.sort:last,[data-defaultSort="-1"]>span.sort:first').addClass('ui-state-highlight'); + this.$con.find('>table>thead input.filter').keyup(function () {
+ list.filter();
+ }).each(function () {
+ if (!this.result)
+ this.result = $('<i style="padding-left:5px;font-weight:normal"></i>').insertAfter(this)[0];
+ }); + }, + sort: function ($el) {
+ $el = $el || this.$con.find('>table>thead .ui-state-highlight');
+ if (!$el.length) return;
+ var i = $el.parent()[0], + d = ($el.hasClass('i-sort-name-down') ? -1 : 1), + trs = this.trs, + l,td; + if (!i.sortInfo) {
+ i = i.cIndex; + for (l = 0; l < trs.length; l++) {
+ td = trs[l].cells[i]; + td.sort = td.getAttribute('data-sort') || $(td).text().toLowerCase();
+ };
+ } else + i = i.cIndex; + trs.sort(function (a, b) {
+ var va = a.cells[i].sort, + vb = b.cells[i].sort; + return (va > vb ? 1 * d : va == vb ? 0 : -1 * d);
+ }); + this.$con.find('>table>tbody').append(trs.slice()); + }, + filter: function(){ + var cells = {},
+ l, i,
+ tr, hide;
+ this.$con.find('>table>thead input.filter').each(function () {
+ if (this.value)
+ cells[this.parentNode.cIndex] = [this.value.toLowerCase(),0,this.result || {}];
+ else if (this.result)
+ this.result.innerHTML= '';
+ });
+ for (l = 0; l < this.trs.length; l++) {
+ tr = this.trs[l];
+ hide = '';
+ for (i in cells) {
+ if (tr.cells[i].innerHTML.toLowerCase().indexOf(cells[i][0]) == -1)
+ hide = 'none';
+ else
+ cells[i][1]++;
+ }
+ tr.style.display = hide;
+ };
+ for (i in cells)
+ if (cells[i][2].innerHTML = cells[i][1]);
+ } +} + +epgd.timerEditChFormat = function (input) {
+ var formats = ',SD,HD,3D', + values = input.value, + i; + if (values) {
+ values = values.split(','); + for (i = 0; i < values.length; i++) + formats = formats.replace(',' + values[i] + ',', ',');
+ } + $('<div title="' + epgd.tr.pages.timerList.chFormat + '"><ol style="float:left; border:2px inset #ddd; min-height:50px; margin-right:20px;">' + + (values.length ? '<li>' + values.join('</li><li>') + '</li>' : '') + + '</ol><ul style="float:left; border:2px inset #ddd; min-height:50px;list-style-type:none">' + + (formats.length > 1 ? '<li>' + formats.slice(1).replace(/,/g, '</li><li>') + '</li>' : '') + '</div>') + .dialog({
+ modal: true, + buttons: [{
+ text: epgd.tr.apply, + click: function () {
+ var val = ''; + $(this).find('ol > li').each(function () { val += ',' + this.innerHTML; }); + input.value = val.slice(1); + $(this).dialog("close");
+ }
+ }, {
+ text: epgd.tr.cancel, + click: function () {
+ $(this).dialog("close");
+ }
+ }]
+ }).find('ul,ol').sortable({
+ connectWith: "ul,ol"
+ }).disableSelection();
+}; + + +// Timer Listen Base Klasse +epgd.timerListBase = epgd.utils.inherits(function (options, dialog) { + this.dialog = dialog; + if (this.dialog) + this.dialog.list = this; + if (!options.conSel) options.conSel = '#content';//'#tabCon'; + if (!options.empty) options.empty = epgd.tr.pages.timerList.empty; + epgd.sortTable.call(this,options); +}, epgd.sortTable); +epgd.timerListBase.prototype.getTable = function () { + var tr = epgd.tr.pages.timerList; + return '<table id="timerList" class="timerTable"><thead><tr><th style="min-width:120px">' + epgd.tr.channel + this.sortIcons + + '</th><th></th><th data-defaultSort="1" colspan="2">' + tr.startTime + this.sortIcons + ' <input type="text" class="filter" style="width:50px" /></th><th>' + + tr.endTime + '</th><th style="min-width:120px">' + epgd.tr.pages.eventDetail.title + this.sortIcons + + ' <input type="text" class="filter" style="width:100px" /></th><th style="min-width:120px">VDR' + this.sortIcons + + ' <input type="text" class="filter" style="width:50px" /></th><th style="min-width:130px">' + this.sortIcons + + (this.o.addNew ? '<span class="iAsButton i-doc-new edit" title="' + tr.newTimer + '"></span>' + + '<span class="iAsButton i-refresh edit" title="' + epgd.tr.reload + '"></span>' : '') + + (this.o.selectable ? '<br clear="all" /><span style="margin-top:3px" class="iAsButton i-trash edit" title="' + epgd.tr.del + '"></span>' + + '<div class="selMarkBlock" style="width:auto"><b title="' + epgd.tr.markAll + '" class="selected" data-t="1"></b><b title="' + epgd.tr.markNone + + '" data-t="0"></b><b title="' + epgd.tr.markToggle + '"><b class="selected"></b></b></div>' : '') + + '</th></tr></thead><tbody></tbody></table>'; +} +epgd.timerListBase.prototype.update = function () { + var timerList = this; + epgd.utils.loader.process(function () {
+ timerList.$con.find('tbody').empty(); + epgd.ajax({ url: epgd.login.url + timerList.o.updateUrl, async: false, cache: false }, function (data) {
+ if (!data.timers.length) {
+ timerList.hideHead();
+ } else {
+ var trs = [], + editIcons = timerList.editIcons, + noEditStates = 'DF', + stateIcons = {
+ 'D': '<div class="i-trash">' + epgd.tr.pages.timerList.timerStates.D + '</div>', // gelöscht + 'E': '<div class="i-warning">' + epgd.tr.pages.timerList.timerStates.E + '</div>', // Fehler + 'F': '<div class="i-ok">' + epgd.tr.pages.timerList.timerStates.F + '</div>', // Aufnahme erfolgreich + 'R': '<div class="i-progress">' + epgd.tr.pages.timerList.timerStates.R + '</div>', // nimmt gerade auf + 'P': '<div class="i-clock">' + epgd.tr.pages.timerList.timerStates.P + '</div>', // wartet auf Aufnhemebeginn + 'U': '<div class="i-help">' + epgd.tr.pages.timerList.timerStates.U + '</div>' // unbekannt + }, + timerActions = epgd.tr.pages.timerList.timerActions, + searchTimerIcon = '<span class="iAsButton i-flashlight edit" title="' + epgd.tr.pages.timer.searchTimerList + ' ' + epgd.tr.edit + '" data-id="$id$">$title$</span>'; + $.each(data.timers, function (id, t) {
+ t.action = t.action ? t.action.toUpperCase() : 'A'; + t.state = t.state ? t.state.toUpperCase() : 'U'; + var vdr = epgd.vdrs.list[t.vdruuid] || { name: '--' }, + //start = t.day ? t.day + parseInt(t.starttime / 100, 10) * 60 * 60 + (t.starttime % 100) * 60 : new String(100 + parseInt(t.endtime / 100, 10)).slice(1) + ':' + (t.endtime % 100), + // searchTimer = t.aux && t.aux.match(/<epgd>.*<expression>([^<]+)<\/expression>/), + tr = $('<tr' + (t.active ? '' : ' class="ui-state-disabled"') + '><td>' + + epgd.channels.getHtml(t.channelid) + '</td><td>' + + (t.action != 'A' + ? '<div class="i-wait">' + timerActions[t.action] + '</div>' + : stateIcons[t.state] + ) + (t.info || '') + '</td>' + + '<td data-sort="' + new String(t.day) + new String(10000 + t.starttime).slice(1) + '">' + + (t.day ? epgd.utils.formatDate(t.day) : '-') + + '</td><td>' + + new String(100 + parseInt(t.starttime / 100, 10)).slice(1) + ':' + new String(100 + parseInt(t.starttime % 100, 10)).slice(1) + + '</td><td>' + + new String(100 + parseInt(t.endtime / 100, 10)).slice(1) + ':' + new String(100 + parseInt(t.endtime % 100, 10)).slice(1) + + '</td><td' + (t.eventid ? ' data-evId="' + t.eventid + '">' + (t.title || '') + '<br />' + (t.shorttext || '') : '>') + '</td><td>' + + vdr.name + '<br />' + (t.directory ? t.directory + '~' : '') + (t.file || '') + '</td><td>' + + (t.autotimerid ? searchTimerIcon.replace('$id$', t.autotimerid).replace('$title$', t.autotimername || t.expression || epgd.tr.pages.timer.searchTimerList) : '') + + (noEditStates.indexOf(t.state) == -1 ? editIcons : '') + '</td></tr>')[0]; + tr.tData = t; + trs.push(tr);
+ }); + timerList.trs = trs; + timerList.showHead(); + /*timerList.$con.find('>table>tbody>tr').find('>td:eq(1)').tooltip({ + items: "div", content: function () { + return this.innerHTML; + } + })*/
+ } + epgd.utils.loader.close(); + $(window).trigger('timerlist_updated', timerList);
+ });
+ },true); +} +epgd.timerListBase.prototype.action = function ($el, iconName,data) { + //this.dialog && this.dialog.close && this.dialog.close(); + var id; + switch (iconName) { + case 'edit': + case 'doc-new': + this.dialog.render($el.closest('tr')[0].tData); + break; + case 'trash': + this.del(this.getSelectedIds($el)); + break; + case 'flashlight': + id = $el.attr('data-id'), + list = this; + $(window).one('searchTimerList_updated', function () { + list.$con.find('tbody>tr').each(function () { + if (this.tData.id == id) { + epgd.pages.searchTimerList.dialog.render(this.tData); + return false; + } + }); + }); + epgd.$menu.menu("select", { target: "#menu_searchTimerList" }); + break; + default: + epgd.sortTable.prototype.action.call(this,$el, iconName, data); + } +}; +epgd.timerListBase.prototype.editIcons = '<span class="iAsButton i-trash edit" title="' + epgd.tr.del + '"></span><span class="iAsButton i-edit edit" title="' + epgd.tr.edit + '"></span>'; +epgd.timerListBase.prototype.getSelectedIds = function ($el) {
+ var ids = [];
+ if ($el[0].parentNode.nodeName == 'TH') {
+ $(this.trs).filter(".selected:visible").each(function () {
+ ids.push(this.tData.id);
+ });
+ } else
+ ids.push($el.closest('tr')[0].tData.id);
+ return ids;
+} +epgd.timerListBase.prototype.del = function (ids, succFunc, arrayName) {
+ var self = this, + allIDs= $.isArray(ids) ? ids : [parseInt(ids,10)]; + ids && allIDs.length && epgd.utils.confirm(epgd.tr.confirmDelete + (allIDs.length > 1 ? '<br />' + allIDs.length + epgd.tr.entries : ''), function (ok) {
+ ok && self.saveArray(allIDs, arrayName || "delete", succFunc);
+ });
+} +epgd.timerListBase.prototype.saveArray = function (ids, arrayName, succFunc) { + var self = this, + allIDs= $.isArray(ids) ? ids : [parseInt(ids,10)], + data= {}; + data[arrayName] = allIDs; + ids && allIDs.length && this.save(data, null, function (jqxhr) {
+ try {
+ var ids = ','; + $(jqxhr.responseJSON.result.failed).each(function () {
+ ids += allIDs[this] + ',';
+ }); + if (ids.length > 1) {
+ $(self.trs).each(function () {
+ if (ids.indexOf(',' + this.tData.id + ',') >= 0) + this.style.backgroundColor = 'red';
+ });
+ }
+ } catch (e) { } + return false;
+ }, succFunc); +}; +epgd.timerListBase.prototype.save = function (data, url, failFunc, succFunc) { + if (!data) return false; + var timerList = this; + epgd.utils.loader.process(function () {
+ epgd.ajax({
+ url: epgd.login.url + (url || timerList.o.saveUrl), + type: 'post', + data: JSON.stringify(data)
+ }, function (data) {
+ data = data.result; + if (data.state == 200) + epgd.utils.topInfo(epgd.tr.dataSaved); + else + epgd.utils.topInfo(data.message, { isError: 1 }); + epgd.utils.loader.close(); + timerList.$con && timerList.$con.parent().length && timerList.update();
+ succFunc && succFunc.call(timerList);
+ }, failFunc);
+ },true); + return true; +} + +// searchResult List - Klasse +epgd.searchResultList = epgd.utils.inherits(function (options, dialog) {
+ epgd.timerListBase.call(this, $.extend({
+ saveUrl: 'data/save-searchtimer'
+ }, options),dialog);
+}, epgd.timerListBase); +epgd.searchResultList.prototype.getTable = function () {
+ var tr = epgd.tr.pages.timerList; + return '<table id="searchResultList" class="timerTable"><thead><tr><th style="min-width:120px">' + epgd.tr.channel + this.sortIcons + '</th><th data-defaultSort="1" colspan="2">' + tr.startTime + this.sortIcons + '</th><th>' + + tr.endTime + '</th><th>' + epgd.tr.pages.eventDetail.title + this.sortIcons + '</th><th></th></tr></thead><tbody></tbody></table>';
+} +epgd.searchResultList.prototype.update = function (d) {
+ if (!d) + return false; + var timerList = this; + d.id && delete d.id;
+ d.name && delete d.name;
+ d.max = epgd.profile.maxListEntries; + epgd.utils.loader.process(function () {
+ timerList.$con.find('tbody').empty();
+ epgd.ajax({
+ url: epgd.login.url + "data/search", + type: 'post', + data: JSON.stringify(d)
+ }, function (data) {
+ var trs = [], i; + if (!data.events || !data.events.length) {
+ timerList.hideHead();
+ } else {
+ data.count > d.max && epgd.utils.popup('Achtung! Es wurden ' + data.count + ' Ergebnisse gefunden. Angezeigt werden aber nur ' + d.max + '.<br /> Das Nachladen ist noch nicht implementiert! Der Wert kann in den Einstellungen angepasst werden');
+ $.each(data.events, function (id, e) {
+ var trClass = '', + icons = '', + d; + if (e.dones) {
+ for (i in e.dones) {
+ d = e.dones[i]; + icons += '<span class="iAsButton" title="' + epgd.tr.pages.timerList.doneStates[d.state] + ' data-id=' + d.id + '">' + d.state + '</span>'; + if (d.state == 'R') + trClass = ' class="ui-state-disabled"';
+ }
+ } + trs.push($('<tr' + trClass + '><td>' + + epgd.channels.getHtml(e.channelid) + '</td><td data-sort="' + e.starttime + '">' + + epgd.utils.formatDate(e.starttime) + '</td><td>' + + epgd.utils.formatTime(e.starttime) + '</td><td>' + + epgd.utils.formatTime(e.starttime + e.duration) + + '</td><td data-evId="' + e.id + '">' + e.title + '<br />' + (e.shorttext || '') + + '</td><td>' + icons + '</td></tr>').tooltip()[0]);
+ }); + timerList.trs = trs; + timerList.showHead();
+ } + epgd.utils.loader.close(); + timerList.dialog && timerList.dialog.resize && window.setTimeout(function(){timerList.dialog.resize();},100); + });
+ },true);
+}; +// Timerliste eines Suchtimers - Klasse +epgd.searchTimerTimerList = epgd.utils.inherits(function (options, dialog) {
+ epgd.timerListBase.call(this, $.extend({
+ saveUrl: 'data/save-timer', + updateUrl: 'data/timers?state=P,R'
+ }, options), dialog);
+}, epgd.timerListBase); +epgd.searchTimerTimerList.prototype.getTable = function () {
+ var tr = epgd.tr.pages.timerList; + return '<table class="timerTable"><thead><tr><th>' + epgd.tr.channel + this.sortIcons + '</th><th data-defaultSort="1" colspan="2">' + tr.startTime + this.sortIcons + '</th><th>' + + tr.endTime + '</th><th>' + epgd.tr.pages.eventDetail.title + this.sortIcons + '</th><th>VDR' + this.sortIcons + '</th><th>' + + '</th></tr></thead><tbody></tbody></table>';
+} +epgd.searchTimerTimerList.prototype.update = function (d) {
+ if (!d) + return false;
+ var timerList = this; + epgd.utils.loader.process(function () {
+ timerList.$con.find('tbody').empty();
+ epgd.ajax({ url: epgd.login.url + timerList.o.updateUrl + '&autotimerid=' + d.id, async: true, cache: false }, function (data) {
+ var trs = [], + editIcons = '<span class="iAsButton i-trash edit" title="' + epgd.tr.del + '"></span>'; + if (!data.timers.length) {
+ timerList.hideHead();
+ } else {
+ $.each(data.timers, function (id, t) {
+ var vdr = epgd.vdrs.list[t.vdruuid] || { name: '--' }, + tr = $('<tr' + (t.active ? '' : ' class="ui-state-disabled"') + '><td>' + + epgd.channels.getHtml(t.channelid) + '</td><td data-sort="' + new String(t.day) + new String(10000 + t.starttime).slice(1) + '">' + + (t.day ? $.datepicker.formatDate(epgd.tr.dateTimePicker.dateFormat, epgd.utils.date(t.day)) : '-') + + '</td><td>' + + new String(100 + parseInt(t.starttime / 100, 10)).slice(1) + ':' + new String(100 + parseInt(t.starttime % 100, 10)).slice(1) + + '</td><td>' + + new String(100 + parseInt(t.endtime / 100, 10)).slice(1) + ':' + new String(100 + parseInt(t.endtime % 100, 10)).slice(1) + + '</td><td' + (t.eventid ? ' data-evId="' + t.eventid + '">' + t.title + '<br />' + (t.shorttext || '') : '>') + '</td><td>' + + vdr.name + '<br />' + t.file + '</td><td>' + + editIcons + '</td></tr>')[0]; + tr.tData = t; + trs.push(tr);
+ }); + timerList.trs = trs; + timerList.showHead();
+ } + timerList.dialog && timerList.dialog.resize && window.setTimeout(function () { timerList.dialog.resize(); }, 100); + epgd.utils.loader.close();
+ });
+ });
+} + +// anstehende Timer +epgd.pages.timerList = new epgd.timerListBase({
+ updateUrl: 'data/timers?state=P,R',
+ saveUrl: 'data/save-timer',
+ selectable: true,
+ addNew: true,
+ right: epgd.rights.umTimer
+}, new epgd.timerDialog()); +// Küzlich erledigte Timer +epgd.pages.timersDone = new epgd.timerListBase({
+ updateUrl: 'data/timers?state=D,F,E&action=A',
+ right: epgd.rights.umTimer
+}); +epgd.pages.timersDone.getTable = function () {
+ return epgd.timerListBase.prototype.getTable.call(this).replace('data-defaultSort="1"', 'data-defaultSort="-1"')
+} +// Timerhistorie +epgd.pages.timerListDone = new epgd.timerListBase({
+ updateUrl: 'data/donetimers', saveUrl: 'data/store-donetimers',
+ selectable: true,
+ right: epgd.rights.umTimer
+}); +epgd.pages.timerListDone.getTable = function () { + return '<table id="timerListDone" class="timerTable"><thead><tr><th style="min-width:120px"><input type="text" class="filter" style="width:40px" />' + + this.sortIcons + '</th><th data-defaultSort="-1" style="min-width:180px">' + + epgd.tr.pages.timerList.recordTime + this.sortIcons + '</th><th>' + + epgd.tr.pages.eventDetail.title + ' <input type="text" class="filter" />' + this.sortIcons + '</th><th style="min-width:120px">' + + epgd.tr.channel + this.sortIcons + '</th><th style="min-width:100px">' + this.sortIcons + + '<span style="margin-top:3px" class="iAsButton i-trash edit" title="' + epgd.tr.del + '"></span>' + + '<div class="selMarkBlock" style="width:auto"><b title="' + epgd.tr.markAll + '" class="selected" data-t="1"></b><b title="' + epgd.tr.markNone + + '" data-t="0"></b><b title="' + epgd.tr.markToggle + '"><b class="selected"></b></b></div>' + + '</th></tr></thead><tbody></tbody></table>'; +} +epgd.pages.timerListDone.action = function ($el, iconName,data) {
+ if (iconName == 'detail' && !$el[0].eventDetail)
+ $el[0].eventDetail = new epgd.doneTimerDetail($el.parent()[0]);
+ epgd.timerListBase.prototype.action.call(this, $el, iconName, data);
+} +epgd.pages.timerListDone.stateIcons = {
+ 'D': '<div class="i-trash">' + epgd.tr.pages.timerList.doneStates.D + '</div>', // gelöscht + 'F': '<div class="i-warning">' + epgd.tr.pages.timerList.doneStates.F + '</div>', // Aufnahme fehlgeschlagen + 'f': '<div class="i-warning">' + epgd.tr.pages.timerList.doneStates.f + '</div>', // Timer konnte nicht erstellt werden + 'R': '<div class="i-ok">' + epgd.tr.pages.timerList.doneStates.R + '</div>', // Aufnahme fertig + 'C': '<div class="i-buffer">' + epgd.tr.pages.timerList.doneStates.C + '</div>', // Timer bereits erstellt + 'Q': '<div class="i-clock">' + epgd.tr.pages.timerList.doneStates.Q + '</div>' // Timer in Vorbereitung +} +epgd.pages.timerListDone.update = function () { + var timerList = this; + epgd.utils.loader.process(function () {
+ epgd.ajax({ url: epgd.login.url + timerList.o.updateUrl, async: false, cache: false }, function (data) {
+ timerList.$con.find('tbody').empty(); + if (!data.donetimers.length) {
+ timerList.hideHead();
+ } else {
+ var trs = [], + tr, i, t, + searchTimerIcon = '<span class="iAsButton i-flashlight edit" title="' + epgd.tr.pages.timer.searchTimerList + ' ' + epgd.tr.edit + '" data-id="$id$">$title$</span>'; + for (i in data.donetimers) {
+ t = data.donetimers[i]; + tr = $('<tr><td>' + + (t.state && timerList.stateIcons[t.state] || '') + '</td>' + + '<td data-sort="' + t.starttime + '">' + + epgd.utils.formatDateTime(t.starttime) + '<br />' + parseInt(t.duration / 60, 10) + ' ' + epgd.tr.minutes + + '</td><td data-evId="' + t.id + '">' + (t.title || '') + '<br />' + (t.shorttext || '') + '</td><td data-sort="' + t.channelid + '">' + + epgd.channels.getHtml(t.channelid) + '</td><td>' + + '<span class="iAsButton i-trash edit" title="' + epgd.tr.del + '"></span>' + + (t.autotimerid ? searchTimerIcon.replace('$id$', t.autotimerid).replace('$title$', t.autotimername || t.expression || epgd.tr.pages.timer.searchTimerList) : '') + + '</td></tr>')[0]; + tr.tData = t; + trs.push(tr);
+ }; + timerList.trs = trs; + timerList.showHead();
+ } + epgd.utils.loader.close(); + $(window).trigger('timerlist_updated', timerList);
+ });
+ },true); +} +// ungesyncte Aufträge +epgd.pages.timerJobList = new epgd.timerListBase({
+ updateUrl: "data/timers?notaction=A",
+ saveUrl: 'data/delete-timerjobs',
+ selectable: true,
+ right: epgd.rights.umTimer
+}, new epgd.timerDialog()); + +// Suchtimer +epgd.pages.searchTimerList = new epgd.timerListBase({
+ saveUrl: 'data/save-searchtimer',
+ right: epgd.rights.umSearchTimer
+}, new epgd.searchTimerDialog()); +epgd.pages.searchTimerList.getTable = function () { + var tr = epgd.tr.pages.timerList; + return '<table id="timerSearchList" class="timerTable"><thead><tr><th data-defaultSort="1">' + + epgd.tr.pages.search.searchName + '/' + epgd.tr.pages.search.searchExpression + ' <input type="text" class="filter" />' + this.sortIcons + '</th><th>' + 'hits' + this.sortIcons + + '</th><th style="min-width:120px">VDR' + this.sortIcons + '</th><th>' + + '<span class="iAsButton i-doc-new edit" title="' + tr.newTimer + '"></span>' + + '<span class="iAsButton i-refresh edit" title="' + epgd.tr.reload + '"></span>' + + '<span class="iAsButton i-link-ext edit" title="' + tr.searchTimerReload + '"></span>' + + '</th></tr></thead><tbody></tbody></table>'; +} +epgd.pages.searchTimerList.action = function ($el, iconName, data) { + epgd.timerListBase.prototype.action.call(this,$el, iconName, data); + switch (iconName) { + case 'link-ext': + this.triggerUpdate(); + break; + case 'down-dir': + if (!$el[0].tList) { + var dialog={
+ $td: $el.parent().css("position", "relative"),
+ tdHeight: $el.parent().outerHeight() + 10,
+ data: $el.parent().parent()[0].tData,
+ resize: function () {
+ var $table = this.list.$con.find('>table').addClass("sub"); + $table.width(this.$td.parent().outerWidth()); + this.$td.height(this.tdHeight + $table.outerHeight(true) + 10); + //this.$td.append(this.list.$con); + },
+ toggle : function (doShow) {
+ this.list.$con.toggle(doShow); + if (doShow) {
+ this.$td.css("height", "100px");
+ this.list.update(this.data);
+ } else + this.$td.css("height", "auto");
+ } + }, + options= {
+ conSel: $('<div style="position:absolute;z-index:5;top:' + dialog.tdHeight + 'px" />').appendTo(document.body) + }; + $el[0].tList = dialog.data.type == 'S' ? new epgd.searchResultList(options, dialog) : new epgd.searchTimerTimerList(options, dialog); + $el[0].tList.render(); + dialog.$td.append(dialog.list.$con); + } + $el[0].tList.dialog.toggle(true); + $el.removeClass('i-down-dir').addClass('i-right-dir'); + break; + case 'right-dir': + $el.removeClass('i-right-dir').addClass('i-down-dir'); + if ($el[0].tList) + $el[0].tList.dialog.toggle(false); + break; + } +} +epgd.pages.searchTimerList.update = function () { + var timerList = this; + this.$con.find('tbody').empty(); + epgd.utils.loader.process(function () {
+ epgd.ajax({ url: epgd.login.url + "data/searchtimers", async: false, cache: false }, function (data) {
+ var trs = [], + editIcons = timerList.editIcons, + typeIcons = { 'V': 'i-tv', 'R': 'i-record', 'S': 'i-search' }; + if (!data.searchtimers.length) {
+ timerList.hideHead();
+ } else {
+ $.each(data.searchtimers, function (id, t) {
+ var vdr = epgd.vdrs.list[t.vdruuid] || { name: '--' }, + tr = $('<tr' + (t.active ? '' : ' class="ui-state-disabled"') + '><td>' + + '<span class="iAsButton i-down-dir edit" title="' + epgd.tr.pages.timer.timerList + '"></span>' + + '<div class="' + typeIcons[t.type] + '">' + (t.name || t.expression) + '</div></td><td' + + (t.type == 'S' ? '>--' : ' data-sort="' + new String('00000' + t.hits).slice(-5) + '">' + t.hits) + '</td><td>' + + vdr.name + '</td><td>' + editIcons + '</td></tr>')[0]; + tr.tData = t; + trs.push(tr);
+ }); + timerList.trs = trs; + timerList.showHead();
+ } + epgd.utils.loader.close(); + $(window).trigger('searchTimerList_updated', timerList);
+ });
+ }); +} +epgd.pages.searchTimerList.triggerUpdate = function () { + var timerList = this; + epgd.ajax({url: epgd.login.url + 'data/updatesearchtimer'},function (data) { + if (data.result.state == 200) + epgd.utils.topInfo(epgd.tr.dataSaved); + else + epgd.utils.topInfo(data.message, { isError: 1 }); + timerList.update(); + }); +} + +epgd.pages.search = new epgd.searchDialog(); + +//message List +epgd.pages.messageList = new epgd.timerListBase({
+ saveUrl: 'data/markmessages',
+ selectable: true
+}) +epgd.pages.messageList.getTable = function () {
+ return '<table id="messageList" class="timerTable"><thead><tr><th style="width:70px">id' + this.sortIcons + '</th>' + + '<th style="width:120px">' + 'Typ' + ' <input type="text" class="filter" style="width:18px" />' + this.sortIcons + '</th>' + + '<th style="width:140px">' + 'Zeit' + this.sortIcons + '</th>' + + '<th style="width:100px">' + 'Titel' + ' <input type="text" class="filter" style="width:50px" />' + this.sortIcons + '</th>' + + '<th style="min-width:140px">' + 'infotext' + ' <input type="text" class="filter" />' + this.sortIcons + '</th>' + + '<th style="min-width:190px"><div class="selMarkBlock" style="width:auto;float: right;">' + +'<b title="' + epgd.tr.markAll + '" class="selected" data-t="1"></b><b title="' + epgd.tr.markNone + '" data-t="0"></b><b title="' + epgd.tr.markToggle + '"><b class="selected"></b></b></div>' + + 'Status' + ' <input type="text" class="filter" style="width:20px" />' + '<br />' + this.sortIcons + + '<span class="iAsButton i-refresh edit" title="' + epgd.tr.reload + '"></span>' + + '<span style="margin-top:3px" class="iAsButton i-trash edit" title="' + epgd.tr.del + '"></span>' + + '<span style="margin-top:3px" class="iAsButton i-check edit" title="' + epgd.tr.pages.timerList.messageStates.R + '"></span>' + + '<span style="margin-top:3px" class="iAsButton i-check-empty edit" title="' + epgd.tr.pages.timerList.messageStates.N + '"></span></th>' + + '</tr></thead><tbody></tbody></table>';
+} +epgd.pages.messageList.update = function (d) {
+ var messList = this; + epgd.utils.loader.process(function () {
+ epgd.ajax({ url: epgd.login.url + "data/messages", async: false, cache: false }, function (data) {
+ messList.$con.find('tbody').empty(); + if (!data.messages.length) {
+ messList.hideHead();
+ } else {
+ var trs = [], + tr, i, t, + icons = {
+ 'N': '<span class="iAsButton i-check-empty edit">' + epgd.tr.pages.timerList.messageStates.N + '</span>', + 'R': '<span class="iAsButton i-check edit">' + epgd.tr.pages.timerList.messageStates.R + '</span>'
+ }, + types = {
+ 'E': '<div class="i-error">' + epgd.tr.pages.timerList.timerStates.E + '</div>', + 'F': '<div class="i-flash-outline">' + epgd.tr.pages.timerList.timerStates.F + '</div>', + 'I': '<div class="i-info">' + epgd.tr.pages.timerList.messageTypes.I + '</div>',
+ 'W': '<div class="i-warning">' + epgd.tr.pages.timerList.messageTypes.W + '</div>'
+ }; + for (i in data.messages) {
+ t = data.messages[i]; + tr = $('<tr><td data-sort="' + new String('0000000' + t.id).slice(-7) + '">' + t.id + '</td>' + + '<td>' + (types[t.type] ||'') +'</td>' + + '<td data-sort="' + t.updsp + '">' + + epgd.utils.formatDateTime(t.updsp) + '</td>' + + '<td>' + t.title + '</td>' + + '<td>' + t.text + '</td>' + + '<td data-sort="' + t.state + t.updsp + '"><span class="iAsButton i-trash edit" title="' + epgd.tr.del + '"></span>' + (icons[t.state] || '') + '</td>' + + '</tr>')[0]; + tr.tData = t; + trs.push(tr);
+ }; + messList.trs = trs; + messList.$con.find('>table>tbody').append(trs.sort(function (a,b) { + return a.tData.state == b.tData.state + ? a.tData.state.updsp > b.tData.state.updsp ? -1 : 1 + : a.tData.state > b.tData.state
+ }).slice()); + messList.showHead();
+ } + epgd.utils.loader.close(); + $(window).trigger('messagelist_updated', messList);
+ });
+ }, true);
+};
+epgd.pages.messageList.action = function ($el, iconName, data) {
+ var ids = this.getSelectedIds($el), + state= null, + i; + if (ids) {
+ switch (iconName) {
+ case 'check': + state = $el[0].parentNode.nodeName == 'TH' ? 'R' : 'N'; + break; + case 'check-empty': + state = $el[0].parentNode.nodeName == 'TH' ? 'N' : 'R'; + break;
+ case 'trash': + state = 'D' + break;
+ }
+ if (state) {
+ for (i in ids)
+ ids[i]= {"id":ids[i], "state":state}
+ state == 'D' ? this.del(ids, null,"messages") : this.saveArray(ids, "messages");
+ return true;
+ }
+ }
+ return epgd.timerListBase.prototype.action.call(this, $el, iconName, data);
+}
+
diff --git a/http/src/js/vdr.js b/http/src/js/vdr.js new file mode 100644 index 0000000..af27b3c --- /dev/null +++ b/http/src/js/vdr.js @@ -0,0 +1,57 @@ +epgd.vdr = function (uuid, data) { + this.uuid = uuid; + $.extend(this, data); +} +epgd.vdr.prototype.switchChannel = function (channelNo) { + epgd.ajax({url: epgd.login.url + 'data/channelswitch?uuid=' + this.uuid + '&channel=' + channelNo, cache: false},function (data) { + epgd.utils.popup(data.result.message, { title: 'VDR', autoClose:5000 }); + }); +} +epgd.vdr.prototype.wol = function () {
+ epgd.ajax({ url: epgd.login.url + 'data/wakeupvdr?uuid=' + this.uuid, cache: false }, function (data) {
+ epgd.utils.popup(data.result.message, { title: 'VDR', autoClose: 5000 });
+ });
+} +epgd.vdrs = { + list: null, + current:null, + load: function () { + if (!this.list) { + this.list = {}; + epgd.ajax({ url: epgd.login.url + "data/vdrs", async: false }, function (data) { + var uuid; + for (uuid in data.vdrs) { + epgd.vdrs.list[uuid] = new epgd.vdr(uuid, data.vdrs[uuid]); + } + if (!epgd.vdrs.current){ + if (epgd.profile.defaultVDRuuid){ + epgd.vdrs.current = epgd.vdrs.list[epgd.profile.defaultVDRuuid]; + if (!epgd.vdrs.current) + epgd.utils.log('the default VDR (' + epgd.profile.defaultVDRuuid + ' is invalid! Please change this in Web Interface/options)'); + } + if (!epgd.vdrs.current){ + for (uuid in epgd.vdrs.list) { + epgd.vdrs.current = epgd.vdrs.list[uuid]; + break; + }
+ } + if (!epgd.vdrs.current){ + epgd.utils.log('no VDR found',2); + epgd.vdrs.current = new epgd.vdr("000-missing-vdr-000", { name: "no VDR found" }); + } + } + $(window).trigger('vdrs_load'); + }); + } + }, + get: function (uuid) { + return this.list[(uuid || this.current)] || {}; + } +}; + + +epgd.pages.vdrs = {
+ render: function () {
+ epgd.$con.html('<div><button class="iAsButton" onclick="epgd.vdrs.current.wol()">WOL</button>');
+ }
+};
\ No newline at end of file diff --git a/http/src/lang/de.js b/http/src/lang/de.js new file mode 100644 index 0000000..2ecb9b0 --- /dev/null +++ b/http/src/lang/de.js @@ -0,0 +1,299 @@ +epgd.tr = { + oClock: "Uhr", + minutes: "min", + save: "speichern", + copy: "kopieren", + apply: "übernehmen", + close: "schließen", + clear: "löschen", + yes: "ja", + no: "nein", + //open: 'öffnen', + edit: "bearbeiten", + cancel: "abbrechen", + del: "löschen", + test: "testen", + reload: "neu laden", + advanced: "erweitert", + markAll: "alle markieren", + markNone: "keinen markieren", + markToggle: "Markierung umdrehen", + confirmDelete: "Willst du wirklich löschen?", + dataSaved: "Daten wurden gespeichert", + dataDeleted: "Daten wurden gelöscht", + dataSend: "Daten wurden gesendet", + channel: "Kanal", + date: "Datum", + entries: " Einträge", + error: { + error: "Fehler", + common: "Es ist ein allgemeiner Fehler aufgetreten", + serverNotResponse: "Der Server konnte nicht erreicht werden!", + notImplemented: "Dieses Feature ist zur Zeit noch nicht implementiert", + forbidden: "Zugriff verweigert!", + noData: "Für diese Anfrage konnten keine Daten ermittelt werden!", + emptyField: "Bitte fülle das Feld $field$ aus!", + invalid: "Der eingegebene Wert ist ungültig!" + }, + menu: { + now: "Programm", + magazine: "Magazin", + timer: "Timer", + records: "Aufnahmen", + search: "Suche", + options: "Einstellungen", + help: "Hilfe" + }, + pages: { + now: { + at:'am' + }, + timer: { + timerList: "Timer", + searchTimerList: "Suchtimer", + timersDone: "kürzliche Aufträge", + timerListDone: "Auftragshistorie", + timerJobList: "asynchrone Aufträge", + messageList: "Systemmeldungen" + }, + timerList: { + empty: "Keine Timer vorhanden!", + startTime: "Anfang", + endTime: "Ende", + folder: "Verzeichnis", + file: "Dateiname", + recordTime: "Aufnahmezeit", + lifetime: "Lebenszeit", + prio: "Priorität", + inactive: "Inaktiv", + newTimer: "Neuen Timer anlegen", + namingMode: "Ermittlung des Dateinamens", + namingModes: ["VDR", "Auto", "Constable", "Serie", "Kategorisiert", "Usermode", "Template"], + template: 'Template', + templateFields: { + "%title%": ": Titel (EPG)", + "%shorttext%": ": Untertitel (EPG)", + "%starttime%": ": Startzeit (EPG)", + "%year%": ": Jahr (EPG)", + "%category%": ": Kategorie (EPG)", + "%episodname%": ": Titel der Serie (constabel)", + "%shortname%": ": Kurz-Titel der Serie (constabel, optional)", + "%partname%": ": Name der Folge (constabel)", + "%season%": ": Staffel (constabel)", + "%part%": ": Teil der Staffel (constabel)", + "%number%": ": Nummer über alle Staffeln (constabel)", + "%extracol1%": ": Zusätzliche Angaben z.B. bei Tatort die Ermittler (constabel, optional)", + "%extracol2%": ": ... z.B. bei Tatort der Ort (constabel, optional)", + "%extracol3%": ": ... z.B. bei Tatort der Sender (constabel, optional)" + }, + episode: "Serientitel", + noEpgMatch: 'Ignoriere fehlende EPG Info', + noRepeat: "Wiederholungen vermeiden", + searchTimerReload: "Suchtimer updaten", + chInclude: "Auf Kanäle einschränken", + chExclude: "Kanäle ausschließen", + nextDays: "innerhalb der nächsten $field$ Tage", + confirmSaveBigResult: "Die Suche ergibt $cnt$ Treffer, trotzdem speichern?", + timerStates: { + 'D': 'gelöscht', + 'E': 'Fehler', + 'F': 'Aufnahme erfolgreich', + 'P': 'wartet auf Aufnahmebeginn', + 'R': 'nimmt gerade auf...', + 'U': 'unbekannt' + }, + timerActions: { + // 'A': 'VDR und EPGD sind synchron', + 'C': 'Timer wurde erstellt und muss noch von einem VDR übernommen werden', + 'D': 'Timer wurde gelöscht und muss noch im VDR gelöscht werden', + 'F': 'Zuweisung Timer an VDR fehlgeschlagen', + 'M': 'Timer wurde verändert und muss noch vom VDR verarbeitet werden' + }, + doneStates: { + 'f': 'Timer konnte nicht erstellt werden', + 'C': 'Timer bereits erstellt', + 'D': 'Timer gelöscht', + 'F': 'Aufnahme fehlgeschlagen', + 'Q': 'Timer in Vorbereitung', + 'R': 'Aufnahme fertig' + }, + messageStates: {
+ 'N': 'Neu', + 'R': 'gelesen' + }, + messageTypes: {
+ 'I': 'Information', + 'W': 'Warnung',
+ 'E': 'Fehler', + 'F': 'Fataler Fehler'
+ }, chFormat: "bevorzugtes Sendeformat" + //channelModes: ["SD", "HD", "3D", "HD,SD", "SD,HD", "3D,HD,SD", "SD,HD,3D"] + }, + eventDetail: { + record: "Aufnehmen", + repeat: "Wiederholungen", + ch_switch: "umschalten", + eventNext: "nachfolgend", + eventPrev: "vorher", + parentalrating: 'ab ', + mergeSrc: 'Quelle ', + genre: 'Genre', + category: 'Kategorie', + country: 'Land', + year: 'Jahr', + season: 'Staffel', + part: 'Folge', + number: 'Folge Insgesamt', + extentedInfo: 'weitere Informationen', + scrapperMovieInfo: 'Filminformation', + scrapperSerieInfo: 'Serieninformation', + constabelInfo: 'Constabel Episodenliste', + addConstableLink: 'Link erzeugen', + loginConstable: 'Login', + title: 'Titel', + original_title: 'Originaltitel', + runtime: 'Laufzeit', + lang: 'Sprache', + release_date: 'Erscheinungsdatum', + actors: 'Schauspieler', + network: 'Netzwerk', + seriesstatus: 'Status', + gueststars: 'Gäste', + homepage: 'Webseite', + popularity: 'Beliebtheit', + vote_average: 'ø Bewertung', + extInfo: { + director: "Regie", + camera: "Kamera", + screenplay: "Drehbuch", + producer: "Produktion", + music: "Musik", + moderator: "Moderator", + commentator: "Kommentator", + guest: "Gäste", + info: "Info", + other: "Sonstige" + } + }, + options:{ + profile: "allgemein", + editChannels: "Kanäle bearbeiten", + editUser: "Benutzer bearbeiten" + }, + editChannels: { + menu: { + channelList: "Kanalliste", + referenceList: "Referenzliste", + insertAsText: "als Text einfügen", + extentEmptyChannelNames: "leere Kanalnamen ergänzen", + applyAllChannelNames: "Alle Kanalnamen übernehmen", + applyChannelSort: "Kanalsortierung übernehmen" + }, + headline: "Sortierung der Kanäle durch drag und drop, Blockmarkierung durch zus. gedrückter shift-Taste", // und der Merge-prioritäten + checkWeb: "Kanal in Webansicht anzeigen", + checkVDR: "Kanal zum VDR übertragen", + desc_insertList: "Kopiere den Inhalt einer channels.conf in das Textfeld unten. Eine vollständige Liste gibt es beispielsweise hier:" + }, + editUser: { + user: "Benutzer", + sel: "auswählen", + add: "neu anlegen", + active: "Aktiv", + inActive: "Inaktiv", + rights: { + label: "Rechte", + umConfig: "Konfiguration lesen", + umConfigEdit: "Konfiguration ändern", + umConfigUsers: "Benutzer konfigurieren", + umTimer: "Timer lesen", + umTimerEdit: "Timer bearbeiten", + umSearchTimer: "Suchtimer lesen", + umSearchTimerEdit: "Suchtimer bearbeiten", + umFsk: "FSK", + umRecordings: "Aufnahmen lesen", + umRecordingsEdit: "Aufnahmen editieren" + } + }, + help: { + url: "lang/hilfe.html", + noHelp: "Hierzu konnte kein Hilfstext gefunden werden" + }, + search: { + search: 'suchen', + searchName: 'Name', + searchExpression: "Suchausdruck", + caseSensitive: "Klein-/Großschreibung", + searchModes: ["exakte Ãœbereinstimmung", "regulärer Ausdruck", "Muster", "enthalten in"], + searchFields: ["Titel", "Kurztext", "Beschreibung"], + empty: "Leider nichts gefunden.", + matchdensity: "Treffergenauigkeit" + }, + login: { + label: 'Login', + userName: 'Benutzername', + password: 'Passwort', + loggedAlwaysIn: 'angemeldet bleiben', + logout: 'Abmelden', + error: 'Fehler beim Anmelden!', + logoutMessage: 'Du wurdest abgemeldet!', + needLogin: 'Login erforderlich' + }, + records: { + ddLabel: "Drag und Drop", + refreshMessage: "Aufnahmelisten werden neu geladen, Seite lädt in $sec$ Sekunden neu", + moveMessage: "Aufnahme verschieben von \n$src$\nnach", + notFoundMessage: "Aufnahme nicht gefunden, ggf einmal aktualisieren", + deleteMessage: "Soll die Aufnahme $src$ wirklich gelöscht werden?", + available: "Verfügbar", + commonRecFolder: "gemeinsame Aufnahmen", + similarTimer: "ähnliche Sendung aufnehmen" + }, + profile: { + mailReceiver: "eMail", + sendTCC: "sende Mail bei Timerkonflikten", + sendMessages: "sende Mail bei Systemmeldungen", + magazinePan: 'Scrollgeschwindigkeit in Minuten<br />(0 = aus)', + magazinePanDelay: 'Auslöseverzögerung', + maxListEntries: 'maximal Anzahl Einträge, die auf einmal vom Server geladen werden sollen, z.B. bei Suchen, Suchtimern usw.', + system: { + label: "epgd Backend" + }, + vdr: { + startWithSched:'EPG Menü startet mit Schedule' + }, + record: {
+ subFolderSort: 'Sortierung der Unterordner'
+ } + } + }, + dateTimePicker: { + monthNames: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', + 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], + monthNamesShort: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', + 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'], + dayNames: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], + dayNamesShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], + dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], + weekHeader: 'KW', + timeOnlyTitle: 'Zeit wählen', + timeText: 'Sendungsbeginn', + timeTextBetween: 'zwischen', + prevText: '<Zurück', + nextText: 'Vor>', + currentText: 'Jetzt', + closeText: 'Fertig', + hourText: 'Stunde', + minuteText: 'Minute', + secondText: 'Sekunde', + millisecText: 'Millisekunde', + microsecText: 'Mikrosekunde', + timezoneText: 'Zeitzone', + timeFormat: 'HH:mm', + dateFormat: 'D, dd.mm.yy', + amNames: ['vorm.', 'AM', 'A'], + pmNames: ['nachm.', 'PM', 'P'], + isRTL: false, + showMonthAfterYear: false, + yearSuffix: '' + } +}; diff --git a/http/src/lang/hilfe.html b/http/src/lang/hilfe.html new file mode 100644 index 0000000..ac2d394 --- /dev/null +++ b/http/src/lang/hilfe.html @@ -0,0 +1,303 @@ +<!DOCTYPE html>
+<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
+<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
+<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
+<!--[if gt IE 8]><!-->
+<html class="no-js">
+ <!--<![endif]-->
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <title>EPGd Hilfe</title>
+ <meta name="description" content="">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1, minimum-scale=1">
+ <link rel="stylesheet" href="../epgd.css">
+ <script src="../common.js"></script>
+ <script src="../epgd.js"></script>
+</head>
+<body>
+ <div id="help">
+ <ul>
+ <li><a href="#h_intro">Allgemein</a></li>
+ <li><a href="#h_now">Aktuell</a></li>
+ <li><a href="#h_magazine">Magazin</a></li>
+ <li><a href="#h_eventDetail">Detailansicht</a></li>
+ <li><a href="#h_records">Aufnahmen</a></li>
+ <li><a href="#h_timer">Timer</a></li>
+ <li><a href="#h_search">Suche</a></li>
+ <li><a href="#h_options">Einstellungen</a></li>
+ <li><a href="#h_about">Ãœber</a></li>
+ </ul>
+ <div id="h_intro">
+ <h3>Electronic Program Guide daemon</h3>
+ <p>
+ Verwaltung von <b>V</b>ideo <b>D</b>isc <b>R</b>ecorder
+ <ul>
+ <li>Anzeige vom aktuellen TV Programm</li>
+ <li>Verwalten deinen Aufnahmn</li>
+ <li>Erzeugen von Timern und Suchtimern</li>
+ </ul></p>
+ <div id="h_datepicker">
+ <h4>Auswahl von Datum und Zeit</h4>
+ Auf der linken Seite werden alle Tage angezeigt, wo Daten vorhanden sind. Auf der rechten Seite kann dann die Uhrzeit eingestellt werden.
+ Das kann dann auf verschiedene Arten passieren. Die obigen Zeiten sind sogenannte Quicklinks, die unter den <a href="#menu_help,h_options">Einstellungen</a> je Nutzer definiert werden können.
+ <br />Wenn das Datum/die Zeit dann eingestellt wurden, muss noch der Knopf "fertig" gedrückt werden oder auch einfach neben dem Datepicker in das Dokument geklickt werden, damit sich die Ansicht aktualisiert.
+ </div>
+ </div>
+ <div id="h_now">
+ <p>In der "Aktuell" Ansicht wird jeweils die aktuelle Sendung von allen für die Web-Oberfläche definierten Kanäle angezeigt.</p>
+ <p>
+ Neben dem Menüpunkt wird dabei <a class="help" id="bh_datepicker"><input type="text" readonly="readonly" value="Datum/Zeit" /></a> angezeigt, auf das sich die aktuelle Anzeige bezieht. Diese kann dort auch durch Anklicken verändert werden.
+ <br />Zusätzlich existiert noch der Knopf <span class="iAsButton i-check-empty">nachfolgend</span>, der jeweils immer die nachfolgende Sendung pro Kanal anzeigt.
+ </p>
+ </div>
+ <div id="h_magazine">
+ <p>In der Magazin-Ansicht wird für die Web-Oberfläche definierten Kanäle das Programm in einer Spaltenansicht angezeigt, je Spalte ein Kanal. Die Anzahl der Spalten/Kanäle richtet sich dabei nach der Bildschirmgröße. Ausgehend von der in der Menüleiste angezeigten <a class="help" id="bh_datepicker"><input type="text" readonly="readonly" value="Datum/Zeit" /></a> wird dann je nach Bildschirmgröße das Programm angezeigt.</p>
+ <p>Das aktuelle Sichtfeld kann dann durch Scrollen nach oben/unten bzw. links/rechts verschoben werden.
+ Auf Desktop-Systemen dazu einfach die Maus in den Randbereich bewegen. Die Empfindlichkeit für dieses Scrollen kann in den Einstellungen angepasst werden.
+ Durch die Buttons oben links/rechts kann dann noch kanalweise oder seitenweise (Anzahl Spalten/Bildschirm) geblättert werden.</p>
+ <p><h5>Warum sind die Programme nicht immer auf gleicher Höhe?</h5>
+ Die Höhe des Kastens für eine Sendung steht in Relation zur Sendedauer. Ist die Sendung kürzer als 10 Minuten, wird sie aber so trotzdem 20 px hoch gezeichnet, als wäre sie 10 Minuten lang, damit zumindest der Titel der vernünftig lesbar ist.
+ Das delta wird dann mit an die nächste Sendung gegeben und diese wird dann in der Höhe um dieses Delta verringert, damit es danach wieder passt. Ggf. wird das aber auch über mehrere Sendung so mitgeschleppt.
+ </p>
+ </div>
+ <div id="h_eventDetail">
+ <p>Hier werden sämtlich Informationen über ein Event/Sendung angezeigt. Dazu werden ggf. spezielle Serieninformtionen oder Filminformationen in einem eigenen Bereich angezeigt. Die Inhalte beschafft das Scraper Plugin.</p>
+ <h3>Constabel Episodenliste</h3>
+ <p>Hier werden alle Episoden aufgelistet, wenn sie bei constabel gepflegt wurden.</p>
+ <div id="h_constabel">
+ <h4>Editieren/ Link hinzufügen</h4>
+ <p>
+ Die Informationen können direkt auf der constabel Seite gepflegt werden. Dazu muss man dort aber bereits eingeloggt sein. Leider kann an dieser Stelle nicht ermittelt werden, ob man bereits eingeloggt ist oder nicht.
+ <br />Den benötigten Account kann man auf dieser Seite auch direkt anfordern.
+ </p>
+ </div>
+ </div>
+ <div id="h_records">
+ <p>
+ Hier werden die Aufnahmen von sämtlichen registrierten VDRs angezeigt.
+ <div id="h_recDD">
+ Die Aufnahmen können hier per Drag and Drop in andere Ordner verschoben oder auch gelöscht werden, indem sie auf die Mülltonne oben links in der Ecke gezogen werden.
+ <br />Für Touchgeräte wird es am Anfang erstmal ausgeschaltet, damit keine versehenliche Aktion ausgelöst wird.
+ </div>
+ Markierte Aufnahmen können auch über einen Klick auf die Mülltonne gelöscht werden.
+ </p>
+ <p>
+ Der Knopf <button class="iAsButton i-refresh">neu laden</button>
+ <span id="h_recRefresh">fordert alle VDRs auf, ihre Aufnahmeverzeichnisse neu einzulesen.
+ <br /> Nach 5 Sekunden wird die Liste neu geladen, da es keine direkte Rückmeldung gibt, wann die mit Einlesen fertig sind.
+ </span>
+ </p>
+ <p>
+ <button class="iAsButton"> ∗</button><input type="text" /><button class="iAsButton">∗ </button><span><button class="iAsButton i-rewind"></button><span id="rSCnt">5</span><button class="iAsButton i-forward"></button></span>
+ <div id="h_recSearch">
+ Hier können Aufnahmen gesucht werden. Die Fundstellen werden dabei markiert.
+ <br />Mit den Sternknöpfen links und rechts kann man das Wort am Anfang und/oder am Ende suchen.
+ <br />Die einzelnen Treffer können mit den Pfeiltasten angesprungen werden.
+ </div>
+ </p>
+ </div>
+ <div id="h_timer" class="accordion">
+ <h3>allgemein</h3>
+ <div>
+ <p>Wenn man im WEB einen Timer für ein Event anlegt und dabei keine Zeiten angibt, wird eine Row in Timers
+ für dieses Event anhand der Event ID erstellt, dabei werden keine Zeiten eingetragen.
+ Übernimmt nun ein VDR bzw. das epg2vdr Plugin den Timer, wird zu dem Event über die Event ID ein Timer angelegt,
+ hierzu werden Funktionen des VDR verwendet, somit kommt alles wie die Zeiten und Titel etc. vom VDR selbst
+ - ohne Einfluss des epgd oder des Plugin.
+ <br />Im Anschluss werden die von VDR gesetzten Daten des angelegten Timers in die Liste übernommen.</p>
+ </div>
+ <h3>Timer</h3>
+ <div>
+ <p>Hier werden alle aktuellen Timer angezeigt, die noch auf Ausführung warten oder die gerade ausgeführt (aufgenommen) werden.</p>
+ </div>
+ <h3>Suchtimer</h3>
+ <div id="h_sTimer">
+ <p>
+ In der Liste sieht man alle gespeicherten Suchtimer. Diese werden unterschieden nach
+ <div class="i-record">Aufnahme-Timer</div>
+ <div class="i-tv">Umschalt-Timer</div>
+ Erzeugt werde diese alle über einen Dialog. Dazu können diverse Parameter eingestellt werden, mit
+ denen regelmäßig das aktuelle Programm durchsucht wird. Aus allen Treffern wird dann automatisch ein Timer erstellt.
+ <div class="i-search">gespeicherte Suche</div>
+ Hier können diverse Parameter in einer Suche gespeichert werden. Diese können dann in der Suche aufgerufen werden oder auch den Quicklinks hinzugefügt werden. Dadurch kann man sich Favoritensuchen erstellen, wie Primetime mit Spielfilmen.
+ </p>
+ Der Dialog beinhaltet folgende Bereiche:
+ <div><h4>Suchausdruck</h4> analog der <a class="help i-help iAsButton" id="bh_sExpr">Suche</a></div>
+ <div id="h_sTRepeat">
+ <h4>Wiederholungen vermeiden</h4>Jeder Treffer wird mit allen bisher aufgenommenen Aufnahmen
+ (siehe auch vorhandene Aufnahmen), bzw. bereits geplanten Aufnahmen anhand der Einstellung Titel, Kurztext und Beschreibung verglichen.
+ Kommt es zu Doppelungen, wird der Treffer verworfen.
+ </div>
+ <div id="h_sTChFormat">
+ <h4>bevorzugtes Sendeformat</h4>Wird eine Sendung sowohl auf einem SD, wie auch auf einem HD Sender gefunden, kann hier eine Priorität vergeben werden, welche Aufnahme genommen werden soll.
+ In dem sich öffnenden Dialog kann per Drag and Drop die Reihenfolge definiert werden
+ </div>
+ <div id="h_sTNameMode">
+ <h4>Ermittlung des Dateinamens</h4>
+ Der Dateinamen wird, mit Ausnahme des Mode 'VDR', über das Python Skript (/etc/epgd/recording.py) ermittelt, er kann bereits Pfadangaben erhalten.
+ <ul>
+ <li>0 VDR: Keine Ermittlung des Dateinamens, die Bezeichnung der Aufnahme wird dem VDR überlassen lediglich das unten angegebene Verzeichnis wird vorangestellt.</li>
+ <li>1 Auto: Automatische Auswahl des Mode Constable, Serie oder Kategorisiert</li>
+ <li>2 Constable: Dateinamen basierend auf Daten von Constabel (Titel/Staffel/xTeil-Nummer/Untertitel) sofern verfügbar</li>
+ <li>3 Serie: Serienaufnahme ohne Verwendung der Constabel Daten (Titel/Untertitel)</li>
+ <li>4 Kategorisiert: Einorden der Aufnahmen entsprechend der Film-Kategorie (Kategorie/Titel)</li>
+ <li>5 User: Hier kann man sich selbst im Python Skript verewigen</li>
+ <li>6 Template: Der Dateiname wird in Eingabefeld unten definiert, hierbei können Platzhalter (%...%) verwendet werden. Bei Eingabe von % erscheint die Auswahl der Platzhalter</li>
+ </ul>
+ <h4>Verzeichnis</h4>Das Verzeichnis wird dem ermittelten Dateinamen (welcher bereits Verzeichnissangaben enthalten kann) vorangestellt. Hier kann entweder aus einem vorhandenen Verzeichnis ausgewählt werden oder es kann ein neuer Verzeichnisname eingegeben werden.
+ </div>
+ <h4>VDR</h4>Es kann direkt ein teilnehmender VDR ausgewählt werden, der aufnehmen soll. Bei auto wird versucht, den VDR aufnehmen zu lassen, der gerade nicht beschäftigt ist.
+ Jörg: wenn aus irgendeinem Grund die Aufnhame nicht stattfindet, wird dann automatisch ein anderer beauftragt?
+ <hr />
+ <button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary ui-state-hover" role="button"><span class="ui-button-icon-primary ui-icon ui-icon-transferthick-e-w"></span><span class="ui-button-text">Timer</span></button>
+ Hier kann man aus einem Suchtimer einen normalen (einmaligen) Timer machen. Soweit möglich werden alle Daten übernommen, die restlichen Daten verfallen.
+ <br /><button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-hover" role="button"><span class="ui-button-text">testen</span></button>
+ ES wird direkt eine Live-Suche durchgeführt und das Ergebnis im Dialog angezeigt
+ </div>
+ <h3>kürzliche Aufnahmen</h3>
+ <div><p>Alle Aufnahmen, die kürzlich ausgeführt wurden. Dabei werden auch gelöschte oder fehlgeschlagene Timer angezeigt</p></div>
+ <h3>Auftragshistorie</h3>
+ <div><p>Alle Timer, die mal aufgenommen wurden, sind hier zu finden. Wenn neue Sendungen anhand eines Suchtimers gefunden wurden, werden die hiermit abgeglichen und dann ggf. verworfen, wenn sie bereits aufgenommen wurden, also in der Tabelle bereits existieren.</p></div>
+ <h3>asynchrone Aufträge</h3>
+ <div><p>Wenn über das WebIf oder durch Suchtimer durch den epgd neue Timer erzeugt werden oder vorhandene gelöscht werden, stehen diese Aufgaben solange in dieser Liste, bis der entsprechende VDR diese abgeholt hat.</p></div>
+ </div>
+ <div id="h_search">
+ <p>Gezielte Suche nach einer Sendung</p>
+ <div id="h_sExpr">
+ <h4>Suchausdruck</h4>
+ <p>
+ Der in dem Eingabefeld eingegebene Begriff wird je nach Einstellung im Titel, Kurztext oder in der Beschreibung gesucht.
+ Weiter kann eingestellt werden, wie genau der Begriff gefunden werden soll:
+ <ul>
+ <li>exakte Ãœbereinstimmung</li>
+ <li>regulärer Ausdruck<br />Hier kann mittels regulärem Ausdruck gesucht werden, <a href="http://Jörg, kennst du nen passenden InternetLink?" target="_blank">siehe</a></li>
+ <li>Muster<br />Jörg todo</li>
+ <li>enthalten in<br />der Suchbegriff muss nur zum Teil gefunden werden</li>
+ </ul>
+ </p>
+ </div>
+ <div id="h_sTAdv">
+ <h4>erweitert</h4>
+ <h5>Serientitel</h5>
+ Was dort steht, wird mit dem Namen der Folge oder, wenn das Event keine Seriendaten hat, mit dem Kurztext verglichen
+ <h5>Staffel, Folge und Jahr</h5>
+ hier kann nummerisch eine Zahl oder Bereich eingetragen werden, z.B.
+ <br />Folge <b>5</b> für genau Folge 5
+ <br />Staffel <b>2-</b> für alles ab der 2. Staffel
+ <br />Jahr <b>-2012</b> für alle Folgen bis einschließlich 2012
+ <br />Folge<b>5-10</b> für die Folgen 5 bis 10
+ <h5>Kategorie und Genre</h5>
+ Hier werden alle Kategorien und Genres aufgelistet, die aktuell in den Events gefunden wurden
+ <h5>Tipp, TagesTipp und TopTipp</h5>
+ Jörg: werden die hier verodert?
+ <h5>Ignoriere fehlende EPG Info</h5>
+ Jörg todo
+ </div>
+ <div id="h_sTChannels">
+ <h4>Kanäle</h4>
+ <h5>Kanäle einschränken oder auschließen</h5>Hier können ein oder mehrere Kanäle definiert werden, die entweder aus der Suche ausgeschlossen werden oder auf denen die Suche eingeschränkt wird.
+ </div>
+ <div id="h_sTime">
+ <h4>Sendungsbeginn</h4>
+ Zeitspanne, in der die Sendung beginnen kann bzw. muss.
+ Zusätzlich kann man noch auf Wochentage einschränken.
+ Für die Favoriten-Suchen kann man dann das Ergebnis z.B. nur auf heute begrenzen, in dem man nur <i>innerhalb der nächsten</i> <b>1</b> Tage sucht.
+ </div>
+ <div id="h_sName">
+ <h4>Name des Timers</h4>
+ Hier kann ein aussagekräftiger Name vergeben werden, der auch in den Listen immer angezeigt wird.
+ </div>
+ </div>
+ <div id="h_options">
+ <h3>allgemein</h3>
+ <div id="h_opt_wif">
+ <p>Hier können diverse Einstellungen gemacht werden. Diese könne sowohl das WebIf als auch das Backend betreffen.</p>
+ </div>
+ <h3>Kanäle bearbeiten</h3>
+ <div><p>Zur Zeit können hier nur die Kanalinformationen für die Weboberfläche bearbeitet werden, zum einen die Reihenfolge und ob sie überhaupt im Web angezeigt werden soll.
+ <br />Dazu kann man sich Referenzlisten von channelpedia laden oder per Textfeld eine beliebig andere einfügen. Daraus können dann leere oder generell auch alle Kanalnamen übernommen werden.
+ Zusätzlich kann auch die Sortierung übernommen werden.</p></div>
+ <h3>Benutzer bearbeiten</h3>
+ <div><p>Hier können die Benutzer für die Weboberfläche verwaltet werden.</p></div>
+ </div>
+ <div id="h_about" class="accordion">
+ <h3>Programmierung</h3>
+ <div id="h_develop">
+ Backend (epg daemon, http daemon): Jörg Wendel
+ <br />SQL/Procedures: Christian Kaiser
+ <br />Frontend (Web): Dirk Hermes
+ <br />VDR Plugin <a href="https://projects.vdr-developer.org/git/vdr-epg-daemon.git/">epg2vdr</a>: Jörg Wendel
+ <br />VDR Plugin <a href="https://projects.vdr-developer.org/projects/plg-scraper2vdr/wiki">scraper2vdr</a>: Stefan Braun
+ </div>
+ <h3>Historie</h3>
+ <div id="h_history"><pre></pre></div>
+ <h3>ToDo's</h3>
+ <div id="h_todo"><pre></pre></div>
+ <h3>Fonts</h3>
+ <div id="h_fonts"><h4>Die Fonts wurden von <a href="http://fontello.com/">Fontello.com</a> eingebunden:</h4><pre></pre></div>
+ </div>
+ <script type="text/javascript">
+
+ </script>
+ </div>
+<script type="text/javascript" id="help_js">
+ epgd.pages.help.init = function () {
+ this.$con.tabs({
+ heightStyle: "content",
+ activate: function (event, ui) {
+ var panel = ui.newPanel[0],
+ hash = panel.id;
+ ui.newPanel.parents('.ui-widget-content').each(function () { hash = this.id + ',' + hash });
+ location.hash = '#menu_' + hash;
+ }
+ });
+ this.initButtons(epgd.pages.help.$con);
+ $('.accordion').accordion({
+ heightStyle: "content",
+ collapsible: true,
+ activate: function (event, ui) {
+ var panel = ui.newPanel[0],
+ hash = panel.id;
+ if (!panel.hasLoaded) {
+ panel.hasLoaded = true;
+ switch (hash) {
+ case "h_fonts":
+ $("pre", panel).load('/font/LICENSE.txt', function () { $('#help').tabs('refresh'); });
+ break;
+ case "h_history":
+ epgd.ajax({ url: '/HISTORY.h', dataType: "html", contentType: "text/plain; charset=utf-8", cache: false }, function (data) {
+ if (data.indexOf('Error:') == -1) {
+ $(panel).html('<pre>' + data.replace(/^#.*\n/gm, '') + '</pre>');
+ }
+ });
+ break;
+ case "h_todo":
+ epgd.ajax({ url: '/TODO', dataType: "html", contentType: "text/plain; charset=utf-8", cache: false }, function (data) {
+ if (data.indexOf('Error:') == -1) {
+ $(panel).html('<pre>' + data.replace(/^#.*\n/gm, '') + '</pre>');
+ }
+ });
+ break;
+ }
+ }
+ ui.newPanel.parents('.ui-widget-content').each(function () { hash = this.id + ',' + hash });
+ location.hash = '#menu_' + hash;
+ }
+ });
+ }
+</script>
+<script type="text/javascript">
+ epgd.pages.help.$con = $('#help');
+ epgd.pages.help.init();
+ try {
+ location.hash && location.hash.length > 10 && $(location.hash.slice(10).replace(/,/g, '],[aria-controls=').slice(2) + ']').each(function () {
+ if (this.className.indexOf('accordion-header') >= 0)
+ $(this).click();
+ else
+ $(this).find('a:first').click();
+ });
+ } catch (e) { }
+</script>
+</body>
+</html>
|