function WEBILIX() {}; WEBILIX.prototype.folder = new function() { this.MKDIR = new function () { this.path = ''; this.Show = function (path) { this.path = path; var button = new wx.popup.BUTTON(); button.SetButton(wx.GetLanguage('admin-folder-mkdir'), 'js@wx.folder.MKDIR.Check();', wx.key.ENTER); button.SetButton(wx.GetLanguage('title-cancel'), 'js@wx.popup.Hide();', wx.key.ESC); var content = ''; content += wx.GetLanguage('admin-folder-mkdir-help') + '

'; content += ''; wx.popup.Show(content, wx.GetLanguage('admin-folder-mkdir'), button); var obj = false; if (obj = document.getElementById('idMKDIR')) obj.focus(); }; this.Check = function () { var obj = document.getElementById('idMKDIR'); if (!obj) return; if ((obj.value == '') || !wx.STRING.Check(obj.value, 'a0-')) { obj.focus(); return; } wx.popup.LoadAJAX('folder-mkdir', [['path', this.path], ['folder', obj.value]]); }; }; this.DELETE = new function () { this.folder = ''; this.file = ''; this.Show = function (folder, file) { this.folder = folder; this.file = file; wx.list.CONFIRM.Show('delete', this.file, 'js@wx.folder.DELETE.Submit();', 'N'); }; this.Submit = function () { var data = [['folder', this.folder], ['file', this.file]]; wx.popup.LoadAJAX('folder-delete', data); }; }; this.FILE = new function () { this.Info = function (folder, file) { var data = [['folder', folder], ['file', file]]; wx.popup.LoadAJAX('folder-info', data); }; this.Link = function (folder, file) { var path = wx.config.download + 'content/' + folder + (folder ? '/' : '') + file; wx.tooltip.Hide(); alert(path); }; }; }; WEBILIX.prototype.ajax = new function() { this.QUERY = function (type, id, page) { this.type = type; this.id = (id ? id : ''); this.page = (page ? page : 1); this.data = []; this.SetData = function (data, value) { value = (isNaN(value) ? value.replace(/&/gi, '%26') : value); this.data[this.data.length] = {data: data, value: value}; }; }; this.type = 0; this.query = []; this.active = false; this.start = 0; this.id = ''; this.INIT = function () { if (window.XMLHttpRequest) { request = new XMLHttpRequest(); this.type = 1; } else if (window.ActiveXObject) { try { request = new ActiveXObject('Msxml2.XMLHTTP'); this.type = 2; } catch (e) { try { request = new ActiveXObject('Microsoft.XMLHTTP'); this.type = 3; } catch (e) {} } } window.setInterval('wx.ajax.Check();', 500); }; this.Check = function () { if (this.active) return this.CheckTimeout(this.start); if (this.query.length == 0) return; if (this.type == 0) { this.query = []; return this.ShowError('disable'); } var request = this.query[0]; this.query.splice(0, 1); this.active = true; this.id = (request.id ? request.id : ''); var dt = new Date(); this.start = (dt.getTime() / 1000); var ajax = null; switch (this.type) { case 1: ajax = new XMLHttpRequest(); break; case 2: ajax = new ActiveXObject('Msxml2.XMLHTTP'); break; case 3: ajax = new ActiveXObject('Microsoft.XMLHTTP'); break; } var data = request.data; if (!data) data = []; var fields = 'AJAXID=' + this.id; for (var d=0; d 1)) path += 'page,' + request.page + '/'; ajax.open("POST", path, true); ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); ajax.send(fields); ajax.onreadystatechange = function() { if (ajax.readyState == 4) { if (!wx.ajax.active) return; if (ajax.status == 200) { if (!ajax.responseText) wx.ajax.ShowError('response'); else { try { eval(ajax.responseText); } catch (e) { if (wx.config.ip == '127.0.0.1') alert('Response:\n' + ajax.responseText); else wx.ajax.ShowError('response'); } } } else { if (wx.config.ip == '127.0.0.1') alert('Status:\n' + ajax.status); else wx.ajax.ShowError('response'); } wx.ajax.active = false; } } }; this.SetQuery = function(query) { this.query[this.query.length] = query; }; this.CheckTimeout = function () { var dt = new Date(); var time = (dt.getTime() / 1000); if ((time - this.start) > 30) this.ShowError('timeout'); }; this.ShowError = function (error) { error = wx.GetLanguage('javascript-ajax-' + error); this.active = false; if (this.id) { var obj = document.getElementById(this.id); if (obj) obj.innerHTML = error; } else { var button = new wx.popup.BUTTON(); button.SetButton(wx.GetLanguage('title-cancel'), 'js@wx.popup.Hide();', wx.key.ESC); wx.popup.Show(error, wx.GetLanguage('javascript-ajax-error'), button); } }; }; WEBILIX.prototype.tools = new function() { this.SEND = new function () { this.type = ''; this.title = ''; this.link = ''; this.name = ''; this.Set = function (type, title, link) { this.type = type; this.title = title; this.link = link; }; this.Show = function () { if (!this.type || !this.title || !this.link) return; var button = new wx.popup.BUTTON(); button.SetButton(wx.GetLanguage('title-send'), 'js@wx.tools.SEND.Send();'); button.SetButton(wx.GetLanguage('title-cancel'), 'js@wx.popup.Hide();', wx.key.ESC); var name = ''; var recipient = ''; var description = ''; var content = ''; content += wx.GetLanguage('javascript-send-comment').replace('<-TYPE->', this.type) + '

'; content += '
'; content += ''; content += ''; content += ''; content += ''; content += ''; content += '
' + this.type + ':' + this.title + '
' + wx.GetLanguage('title-link') + ':' + this.link + '
' + wx.GetLanguage('title-name') + ':' + name + '
' + wx.GetLanguage('title-recipient') + ':' + recipient + '
' + wx.GetLanguage('title-description') + ':' + description + '
'; wx.popup.Show(content, wx.GetLanguage('title-send'), button, 450); document.getElementById(this.name ? 'idTSendRECIPIENT' : 'idTSendNAME').focus(); }; this.Send = function () { var name = document.getElementById('idTSendNAME'); var recipient = document.getElementById('idTSendRECIPIENT'); var description = document.getElementById('idTSendDESCRIPTION'); if (!name || !recipient || !description) return; var send = true; var error = document.getElementById('idTSendRECIPIENTERROR'); error.style.display = 'none'; if (recipient.value == '') { error.innerHTML = wx.GetLanguage('field-help-required'); error.style.display = ''; recipient.focus(); send = false; } else if (!wx.STRING.CheckEmail(recipient.value)) { error.innerHTML = wx.GetLanguage('field-help-email'); error.style.display = ''; recipient.focus(); send = false; } error = document.getElementById('idTSendNAMEERROR'); error.style.display = 'none'; if (name.value == '') { error.innerHTML = wx.GetLanguage('field-help-required'); error.style.display = ''; name.focus(); send = false; } if (!send) return; this.name = name.value; var data = [['type', this.type], ['title', this.title], ['link', this.link]]; data[data.length] = ['name', name.value]; data[data.length] = ['recipient', recipient.value]; data[data.length] = ['description', description.value]; wx.popup.LoadAJAX('tools-send', data); }; }; }; WEBILIX.prototype.block = new function () { this.PRAYER = new function () { this.lg = [49.70, 48.30, 45.07, 51.64, 48.68, 46.42, 57.33, 56.29, 50.84, 59.21, 46.28, 51.41, 48.34, 49.59, 60.86, 48.50, 53.06, 53.39, 47.00, 50.86, 52.52, 50.00, 50.88, 57.06, 47.09, 54.44, 59.58, 48.52, 51.59, 54.35]; this.lt = [34.09, 38.25, 37.55, 32.68, 31.32, 33.64, 37.47, 27.19, 28.97, 32.86, 38.08, 35.70, 33.46, 37.28, 29.50, 36.68, 36.57, 35.58, 35.31, 32.33, 29.62, 36.28, 34.64, 30.29, 34.34, 36.84, 36.31, 34.80, 30.67, 31.89]; this.index = 0; this.SinD = function (x) { return Math.sin(Math.PI / 180.0 * x); }; this.CosD = function (x) { return Math.cos(Math.PI / 180.0 * x); }; this.TanD = function (x) { return Math.tan(Math.PI / 180.0 * x); }; this.AsinD = function (x) { return Math.asin(x) * 180.0 / Math.PI; }; this.AcosD = function (x) { return Math.acos(x) * 180.0 / Math.PI; }; this.AtanD = function (x) { return Math.atan(x) * 180.0 / Math.PI; }; this.L2H = function (z, d, p) { return this.AcosD((this.CosD(z) - this.SinD(d) * this.SinD(p)) / this.CosD(d) / this.CosD(p)) / 15; }; this.Round = function (x, a) { var tmp = x % a; if(tmp < 0) tmp += a; return(tmp); }; this.Sun = function (month, day, hour, lg) { if(month < 7) day = 31 * (month - 1) + day + hour / 24; else day = 6 + 30 * (month - 1) + day + hour / 24; var M = 74.2023 + 0.98560026 * day; var L = -2.75043 + 0.98564735 * day; var lst = 8.3162159 + 0.065709824 * Math.floor(day) + 1.00273791 * 24 * (day % 1) + lg / 15; var e = 0.0167065; var omega = 4.85131 - 0.052954 * day; var ep = 23.4384717 + 0.00256 * this.CosD(omega); var ed = 180.0 / Math.PI * e; var u = M; for(var i = 1; i < 5; i++) u = u - (u - ed * this.SinD(u) - M) / (1 - e * this.CosD(u)); var v = 2 * this.AtanD(this.TanD(u / 2) * Math.sqrt((1 + e) / (1 - e))); var theta = L + v - M - 0.00569 - 0.00479 * this.SinD(omega); var delta = this.AsinD(this.SinD(ep) * this.SinD(theta)); var alpha = 180.0 / Math.PI * Math.atan2(this.CosD(ep) * this.SinD(theta), this.CosD(theta)); if (alpha >= 360) alpha -= 360; var ha = lst - alpha / 15; var zr = this.Round(hour - ha, 24); return [zr, delta]; }; this.GetTime = function (time) { time = Math.floor(3600 * time); var hur = Math.floor(time / 3600); time = time - 3600 * hur; var mnt = Math.floor(time / 60); time = time - 60 * mnt; var snd = Math.floor(time); hur++; time = ''; time += ((hur < 10) ? '0' : '') + hur.toString() + ':'; time += ((mnt < 10) ? '0' : '') + mnt.toString() + ':'; time += ((snd < 10) ? '0' : '') + snd.toString(); return wx.NUMBER.Change(time, true); }; this.Show = function (block) { var index = document.getElementById('idBlock' + block + 'LIST'); if (!index) return; this.index = index.selectedIndex; var date = wx.date.GetDate().split('-'); var month = parseInt(date[1], 10); var day = parseInt(date[2], 10); var obj = false; var time = false; var ep = false; var zr = false; var delta = false; var ha = false; /* SB */ obj = document.getElementById('idBlock' + block + 'SB'); if (obj) { ep = this.Sun(month, day, 4, this.lg[this.index]); zr = ep[0]; delta = ep[1]; ha = this.L2H(108.0, delta, this.lt[this.index]); time = this.Round(zr - ha, 24); ep = this.Sun(month, day, time, this.lg[this.index]); zr = ep[0]; delta = ep[1]; ha = this.L2H(108.0, delta, this.lt[this.index]); time = this.Round(zr - ha, 24); obj.innerHTML = this.GetTime(time); } /* TL */ obj = document.getElementById('idBlock' + block + 'TL'); if (obj) { ep = this.Sun(month, day, 6, this.lg[this.index]); zr = ep[0]; delta = ep[1]; ha = this.L2H(90.833, delta, this.lt[this.index]); time = this.Round(zr - ha, 24); ep = this.Sun(month, day, time, this.lg[this.index]); zr = ep[0]; delta = ep[1]; ha = this.L2H(90.833, delta, this.lt[this.index]); time = this.Round(zr - ha, 24); obj.innerHTML = this.GetTime(time); } /* ZR */ obj = document.getElementById('idBlock' + block + 'ZR'); if (obj) { ep = this.Sun(month, day, 12, this.lg[this.index]); zr = ep[0]; delta = ep[1]; obj.innerHTML = this.GetTime(zr); } /* GH */ obj = document.getElementById('idBlock' + block + 'GH'); if (obj) { ep = this.Sun(month, day, 18, this.lg[this.index]); zr = ep[0]; delta = ep[1]; ha = this.L2H(90.833, delta, this.lt[this.index]); time = this.Round(zr + ha, 24); ep = this.Sun(month, day, time, this.lg[this.index]); zr = ep[0]; delta = ep[1]; ha = this.L2H(90.833, delta, this.lt[this.index]); time = this.Round(zr + ha, 24); obj.innerHTML = this.GetTime(time); } /* MG */ obj = document.getElementById('idBlock' + block + 'MG'); if (obj) { ep = this.Sun(month, day, 18.5, this.lg[this.index]); zr = ep[0]; delta = ep[1]; ha = this.L2H(94.3, delta, this.lt[this.index]); time = this.Round(zr + ha, 24); ep = this.Sun(month, day, time, this.lg[this.index]); zr = ep[0]; delta = ep[1]; ha = this.L2H(94.3, delta, this.lt[this.index]); time = this.Round(zr + ha, 24); obj.innerHTML = this.GetTime(time); } }; }; this.POLL = new function () { this.poll = []; this.SetPoll = function (poll, item, multiple, style) { this.poll[poll] = {item: item, multiple: multiple, style: style}; }; this.Check = function (poll, item) { if (!this.poll[poll]) return; var data = this.poll[poll]; if (data.multiple == 'N') for (var i=0; i (count - 1)) current = 0; var obj = false; for (var c=0; c', page))); }; this.ShowList = function (action, maximum, current) { this.action = (action ? action : this.action); if (maximum < 1) return; var inpage = 100; var inrow = 10; var page = parseInt((maximum / inpage), 10); if ((page * inpage) != maximum) page++; var begin = 0; var end = 0; current = (isNaN(parseInt(current)) ? 1 : parseInt(current)); if (current < 1) current = 1; else if (current > page) current = page; var title = ''; if (page > 1) { title += '
'; title += '
'; } current--; begin = (current * inpage); end = begin + inpage; if (end > maximum) end = maximum; var content = ''; content += '
'; content += ''; for (var n=begin; n' : '') + '' + (((n % inrow) == (inrow - 1)) ? '' : ''); } content += '
'; content += ''; content += wx.NUMBER.Change(n + 1, true) + '
'; var button = new wx.popup.BUTTON(); button.SetButton(wx.GetLanguage('title-cancel'), 'js@wx.popup.Hide();', wx.key.ESC); wx.popup.Show(content, title + wx.GetLanguage('title-select'), button, ((begin < 1000) ? false : 450)); }; }; this.SLIDE = new function () { this.CHECK = new function() { this.check = []; this.Check = function (id) { if (!this.check[id]) return; var height = document.getElementById(id + 'Content').offsetHeight; document.getElementById(id).style.height = height + 'px'; window.setTimeout('wx.content.SLIDE.CHECK.Check(\'' + id + '\');', 100); }; this.Start = function (id) { this.check[id] = true; this.Check(id); }; this.Stop = function (id) { this.check[id] = false; }; }; this.active = []; this.timeout = 0; this.GetStatus = function (id) { return wx.GetData(id + 'STATUS'); }; this.Deactive = function (id) { this.active = wx.ARRAY.Delete(id, this.active); }; this.GetChange = function (height) { var change = parseInt(height / 10, 10); return ((change < 1) ? 1 : change); }; this.SlideOUT = function (id, value) { var slide = document.getElementById(id); var content = document.getElementById(id + 'Content'); var change = this.GetChange(content.offsetHeight); if (!value) { slide.style.display = ''; slide.style.height = '1px'; this.SlideOUT(id, 1); } else { value += change; if (value <= content.offsetHeight) { slide.style.height = value + 'px'; window.setTimeout('wx.content.SLIDE.SlideOUT(\'' + id + '\', ' + value + ');', this.timeout); } else { slide.style.overflow = ''; slide.style.height = content.offsetHeight + 'px'; this.Deactive(id); this.CHECK.Start(id); } } }; this.SlideIN = function (id, value) { var slide = document.getElementById(id); var content = document.getElementById(id + 'Content'); var change = this.GetChange(content.offsetHeight); if (!value) { this.CHECK.Stop(id); slide.style.height = content.offsetHeight + 'px'; slide.style.overflow = 'hidden'; this.SlideIN(id, content.offsetHeight); } else { value -= change; if (value >= 1) { slide.style.height = value + 'px'; window.setTimeout('wx.content.SLIDE.SlideIN(\'' + id + '\', ' + value + ');', this.timeout); } else { slide.style.display = 'none'; this.Deactive(id); } } }; this.Slide = function (id) { if (wx.ARRAY.Exists(id, this.active)) return; this.active[this.active.length] = id; var status = wx.GetData(id + 'STATUS', 'C'); wx.SetData(id + 'STATUS', ((status == 'C') ? 'O' : 'C')); if (status == 'C') this.SlideOUT(id); else this.SlideIN(id); }; }; this.MENU = new function () { this.close = false; this.last = []; this.Active = function (id, className) { this.Deactive(); var obj = document.getElementById(id); if (!obj) return false; obj.className = className + 'Over'; var obj = document.getElementById(id + 'SUB'); if (!obj) return false; obj.style.display = 'block'; this.last = [id, className]; this.close = false; this.Check(); }; this.Check = function () { if (this.close) this.Deactive(); else window.setTimeout('wx.content.MENU.Check()', 1000); }; this.Deactive = function () { if (this.last.length == 0) return false; var obj = document.getElementById(this.last[0]); if (!obj) return false; obj.className = this.last[1]; var obj = document.getElementById(this.last[0] + 'SUB'); if (!obj) return false; obj.style.display = 'none'; this.last = []; }; this.SetOver = function (id, style, over) { var list = ['IMAGE', 'ITEM']; var obj = null; for (l=0; l this.marquee[id].height) top = (0 - content.offsetHeight); content.style.top = top; this.marquee[id].top = top; }; this.CheckD = function (id) { if (this.marquee[id].pause) return; var frame = document.getElementById(id + 'FRAME'); if (!frame) return; var content = document.getElementById(id + 'CONTENT'); if (!content) return; var top = this.marquee[id].top - this.marquee[id].speed; if (top < (0 - content.offsetHeight)) top = this.marquee[id].height; content.style.top = top; this.marquee[id].top = top; }; this.Check = function (id) { if (!this.marquee[id]) return; switch (this.marquee[id].direction) { case 'U': this.CheckU(id); break; case 'D': this.CheckD(id); break; } window.setTimeout('wx.content.MARQUEE.Check(\'' + id + '\');', this.marquee[id].delay * 10); }; }; this.UPLOAD = new function () { this.config = false; this.comment = false; this.data = []; this.SetConfig = function (type, volume, description, image, flash) { this.config = {type: type, volume: volume, description: description, image: image, flash: flash}; this.comment = false; this.data = []; }; this.SetComment = function (comment) { this.comment = comment; }; this.SetData = function (data, value) { this.data[this.data.length] = [data, value]; }; this.GetName = function (name) { if (name == '') return ''; name = name.split('\\'); return name[name.length - 1]; }; this.Check = function () { var file = document.getElementById('idUploadFILE'); if (!file) return; var description = ''; if (!file.value) { file.focus(); return; } if (this.config.description != 'N') { description = document.getElementById('idUploadDESC'); if (!description) return; if ((this.config.description == 'R') && !description.value) { description.focus(); return; } description = description.value; } document.getElementById('idUploadFORM').style.display = 'none'; document.getElementById('idUploadLOADING').style.display = ''; var button = new wx.popup.BUTTON(); button.SetButton(wx.GetLanguage('title-cancel'), 'js@if (object = document.getElementById(\'idUploadFRAME\')) object.src = \'about:blank\'; wx.popup.Hide();', wx.key.ESC); wx.popup.SetContent(false, false, button); var data = [['TYPE', this.config.type]]; if (this.config.volume) data[data.length] = ['VOLUME', this.config.volume]; if (description) data[data.length] = ['DESCRIPTION', description]; if (this.config.image) data[data.length] = ['IMAGE', 'Y']; if (this.config.flash) data[data.length] = ['FLASH', 'Y']; for (var d=0; d' + image + '' : false); var content = ''; content += '
'; content += wx.GetLanguage('javascript-upload-comment') + (this.comment ? ' ' + this.comment : ''); content += (image ? ' ' + wx.GetLanguage('javascript-upload-image').replace('<-FORMAT->', image) : ''); content += ((this.config.description == 'O') ? ' ' + wx.GetLanguage('javascript-upload-desc-O') : ''); content += ((this.config.description == 'R') ? ' ' + wx.GetLanguage('javascript-upload-desc-R') : ''); content += '
' + wx.GetLanguage('javascript-upload-volume') + ': ' + (this.config.volume ? wx.GetVolume(this.config.volume * 1024) : '1G') + '

'; content += '
'; content += ((this.config.description != 'N') ? '' : ''); content += '
'; wx.popup.Show(content, wx.GetLanguage('title-upload'), button, false, true); }; }; this.ATTACHMENT = new function () { this.attachment = []; this.Set = function (id, description, value) { this.attachment[id] = {description: description, value: value}; this.Show(id); }; this.SetValue = function (id, file, description, volume, download, icon, link) { wx.popup.Hide(); if (!this.attachment[id]) return; var value = this.attachment[id].value; value[value.length] = {file: file, description: description, volume: volume, download: download, icon: icon, link: link}; this.attachment[id].value = value; this.Show(id); }; this.GetIndex = function (id, file) { if (!this.attachment[id]) return -1; var value = this.attachment[id].value; for (var v=0; v'; var edt = ''; var del = ''; var dnl = ''; var view = ''; var style = ''; view += '
'; var list = []; for (var v=0; v'; view += '
' + value[v].description; view += '

' + ''; view += ((v != 0) ? up.replace('<-FILE->', value[v].file) + '  ' : ''); view += ((this.attachment[id].description != 'N') ? edt.replace('<-FILE->', value[v].file) + '  ' : ''); view += del.replace('<-FILE->', value[v].file) + '  '; view += dnl.replace('<-FILE->', value[v].file); view += '' + wx.GetLanguage('title-download') + ': ' + wx.NUMBER.Change(value[v].download); view += ' - ' + wx.GetLanguage('value-volume') + ': ' + wx.GetVolume(value[v].volume); view += ' 
'; } view += '
'; view += '
'; document.getElementById(id).value = '|' + list.join('|') + '|'; document.getElementById(id + 'VIEW').innerHTML = view; }; }; this.GALLERY = new function () { this.gallery = []; this.Set = function (id, description, value) { this.gallery[id] = {description: description, value: value}; this.Show(id); }; this.SetValue = function (id, file, description, volume, icon) { wx.popup.Hide(); if (!this.gallery[id]) return; var value = this.gallery[id].value; value[value.length] = {file: file, description: description, volume: volume, icon: icon}; this.gallery[id].value = value; this.Show(id); }; this.GetIndex = function (id, file) { if (!this.gallery[id]) return -1; var value = this.gallery[id].value; for (var v=0; v'; var edt = ''; var del = ''; var view = ''; var style = ''; view += '
'; var list = []; for (var v=0; v'; view += '
' + value[v].description; view += '

' + ''; view += ((v != 0) ? up.replace('<-FILE->', value[v].file) + '  ' : ''); view += ((this.gallery[id].description != 'N') ? edt.replace('<-FILE->', value[v].file) + '  ' : ''); view += del.replace('<-FILE->', value[v].file); view += '' + wx.GetLanguage('value-volume') + ': ' + wx.GetVolume(value[v].volume); view += ' 
'; } view += '
'; view += '
'; document.getElementById(id).value = '|' + list.join('|') + '|'; document.getElementById(id + 'VIEW').innerHTML = view; }; }; this.TREE = new function () { this.Check = function (tree, status) { var obj = document.getElementById(tree); if (!obj) return; status = wx.GetData(tree + 'STATUS', status); wx.SetData(tree + 'STATUS', ((status == 'C') ? 'O' : 'C')); obj.style.display = ((status == 'C') ? '' : 'none'); document.getElementById(tree + 'IMAGE').src = wx.config.general + 'tree/' + ((status == 'C') ? 'open' : 'close') + '.gif'; }; }; }; WEBILIX.prototype.related = new function () { this.related = []; this.MODULE = new function () { this.module = []; this.Set = function (module) { this.module = module; }; this.Get = function (module) { var list = []; for (var m=0; m'; content = ''; content += '
'; for (var l=0; l' + wx.NUMBER.Change(l + 1) + ''; content += ''; content += ''; content += ''; } content += '
' + list[l].title + '' + del.replace('<-DATA->', list[l].data) + '

'; document.getElementById(id + module[m] + 'COUNT').innerHTML = wx.NUMBER.Change(list.length); document.getElementById(id + module[m] + 'VIEW').innerHTML = content; } document.getElementById(id).value = data.join('|'); }; }; WEBILIX.prototype.list = new function () { this.LIST = new function () { this.field = []; this.data = []; this.show = ''; this.save = false; this.SetField = function (field) { this.field = field; }; this.SetView = function (status) { var obj = false; for (var f=0; f= parseInt(value2, 10))) return false; break; case 'date': case 'time': if ((select == '-') && (value1 >= value2)) return false; break; } return true; }; this.Post = function () { var data = [['REPORT', 'TRUE'], ['SHOW', this.show]]; data[data.length] = ['SAVE', (this.save ? 'TRUE' : 'FALSE')]; for (var d=0; d' + value1 + '<0:0:0><0:1:0>' + value2 + '<0:1:0>'}; if (this.Check(this.field[f].type, select.value, value1, value2)) continue; select.className = 'cToolbarObjectSELECTERROR'; error = true; } if (error) return; this.CheckView(); this.Post(); }; }; this.TOOLBAR = new function () { this.toolbar = []; this.error = false; this.SetData = function (id, data) { this.toolbar[id] = data; }; this.CheckSearch = function (id) { var search = this.toolbar[id].search; for (var s=0; s 1)) url += 'page,' + page + '/'; var post = [['LIST', id]]; post = this.GetSearch(id, post); post = this.GetDate(id, post); post = this.GetSelect(id, post); post = this.GetFooter(id, post); wx.Post(post, url); }; }; this.CONFIRM = new function() { this.type = ''; this.title = ''; this.action = ''; this.description = 'N'; this.Show = function (type, title, action, description) { this.type = type; this.title = title; this.action = action; this.description = (wx.ARRAY.Exists(description, ['N', 'O', 'R']) ? description : 'N'); var button = new wx.popup.BUTTON(); button.SetButton(wx.GetLanguage('title-confirm'), 'js@wx.list.CONFIRM.Check();'); button.SetButton(wx.GetLanguage('title-cancel'), 'js@wx.popup.Hide();', wx.key.ESC); title = (title ? title : wx.GetLanguage('javascript-confirm-' + type + '-title')); var content = ''; content += ''; content += wx.GetLanguage('javascript-confirm-' + type + '-content') + ' '; if (this.description != 'N') { content += wx.GetLanguage('javascript-confirm-description-' + this.description) + '

'; content += ''; } wx.popup.Show(content, title, button, 450); }; this.Check = function () { if (this.description == 'N') eval(wx.GetAction(this.action)); else { var description = document.getElementById('idConfirmDESCRIPTION'); if (!description) document.location.href = this.action; else { if ((this.description == 'R') && !description.value) { description.focus(); return; } wx.Post([['description', description.value]], this.action); } } }; }; this.list = []; this.SetList = function (list, item, tools, column, action, toolbar) { this.TOOLBAR.SetData(list, toolbar); this.list[list] = {item: item, tools: tools, column: column, action: action, active: []}; }; this.SetOver = function (list, item, style, over) { if (!this.list[list]) return; if (wx.ARRAY.Exists(item, this.list[list].active)) return; var tools = document.getElementById(item + 'TOOLS'); if (tools) tools.className = (over ? 'cListTOOLS' : style + 'TOOLS'); var status = document.getElementById(item + 'STATUS'); if (status) status.className = (over ? 'cListSTATUS' : style + 'STATUS'); var view = document.getElementById(item + 'VIEW'); if (view) view.className = (over ? 'cListVIEW' : style + 'VIEW'); var action = document.getElementById(item + 'ACTION'); if (action) action.className = (over ? 'cListACTION' : style + 'ACTION'); for (var v=0; v'; content += ' '; content += '' + wx.GetLanguage('title-value') + ':'; content += ''; wx.popup.Show(content, wx.GetLanguage('title-order'), button, 300); } }; }; WEBILIX.prototype.date = new function() { this.date = new Date(); this.data = {}; this.INIT = function () { var date = wx.config.now.date.split('-'); for (var d=0; d1 && ((gy % 4 == 0 && gy % 100 != 0) || (gy % 400 == 0))) ++g_day_no; g_day_no += gd; var j_day_no = g_day_no - 79; var j_np = this.Div(j_day_no, 12053); j_day_no %= 12053; var jy = 979 + 33 * j_np + 4 * this.Div(j_day_no, 1461); j_day_no %= 1461; if (j_day_no >= 366) { jy += this.Div(j_day_no - 1, 365); j_day_no = (j_day_no - 1) % 365; } for (var i=0; i<11 && j_day_no >= fDays[i]; ++i) j_day_no -= fDays[i]; var jm = i + 1; var jd = j_day_no + 1; return {year: jy, month: jm, day: jd}; }; this.ChangeP2E = function (year, month, day) { var eDays = this.data.enDays; var fDays = this.data.faDays; var jy = year - 979; jm = month - 1; jd = day - 1; var j_day_no = 365 * jy + this.Div(jy, 33) * 8 + this.Div(jy % 33 + 3, 4); for (var i=0; i < jm; ++i) j_day_no += fDays[i]; j_day_no += jd; var g_day_no = j_day_no + 79; var gy = 1600 + 400 * this.Div(g_day_no, 146097); g_day_no = g_day_no % 146097; var leap = true; if (g_day_no >= 36525) { g_day_no--; gy += 100 * this.Div(g_day_no, 36524); g_day_no = g_day_no % 36524; if (g_day_no >= 365) { g_day_no++; } else { leap = false; } } gy += 4 * this.Div(g_day_no, 1461); g_day_no %= 1461; if (g_day_no >= 366) { leap = false; g_day_no--; gy += this.Div(g_day_no, 365); g_day_no = g_day_no % 365; } for (var i = 0; g_day_no >= eDays[i] + (i == 1 && leap); i++) g_day_no -= eDays[i] + (i == 1 && leap); var gm = i + 1; var gd = g_day_no + 1; return {year: gy, month: gm, day: gd}; }; this.GetDate = function (date) { if (!date) date = this.date; var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); switch (wx.config.date) { case 'fa': var date = this.ChangeE2P(year, month, day); break; default: var date = {year: year, month: month, day: day}; break; } if (date.month < 10) date.month = '0' + date.month; if (date.day < 10) date.day = '0' + date.day; return date.year + '-' + date.month + '-' + date.day; }; this.GetValue = function (date, time) { date = date.split('-'); if (!time) time = '12:00:00'; time = time.split(':'); var year = parseInt(date[0], 10); var month = parseInt(date[1], 10); var day = parseInt(date[2], 10); var hour = parseInt(time[0], 10); var minute = parseInt(time[1], 10); var second = parseInt(time[2], 10); switch (wx.config.date) { case 'fa': var date = this.ChangeP2E(year, month, day); break; default: var date = {year: year, month: month, day: day}; break; } return new Date(date.year, date.month - 1, date.day, hour, minute, second); }; this.GetCalendar = function (date) { var check = date.substr(0, 8); var dt = ((wx.config.date == 'en') ? 0 : 6); var start = this.GetValue(date); while (this.GetDate(start).substr(0, 8) == check) start.setDate(start.getDate() - 1); if (start.getDay() != 5) while (start.getDay() != dt) start.setDate(start.getDate() - 1); else start.setDate(start.getDate() + 1); var dt = ((wx.config.date == 'en') ? 6 : 5); var end = this.GetValue(date); while (end.getDay() != dt) end.setDate(end.getDate() + 1); while (this.GetDate(end).substr(0, 8) == check) end.setDate(end.getDate() + 7); if (this.GetDate(end).substr(8, 2) == '07') end.setDate(end.getDate() - 7); return {start: start, end: end}; }; this.GetView = function (date) { date = (date ? date : this.GetDate()); var value = this.GetValue(date, '12:00:00'); var week = ((value.getDay() + 1) % 7); var name = wx.GetLanguage('value-day'); week = name[week]; date = date.split('-'); var year = date[0]; var day = date[2]; var month = parseInt(date[1], 10); var name = wx.GetLanguage('value-month'); month = name[month - 1]; return week + ' - ' + wx.NUMBER.Change(day, true) + ' ' + month + ' ' + wx.NUMBER.Change(year, true); }; }; WEBILIX.prototype.report = new function () { this.REPORT = new function () { this.id = 'idReportREPORT'; this.Post = function (field, action, group, index, data) { field = wx.report.GetField(field); if (!field || !field.report) return; wx.SetData(this.id + 'SUBMIT', false); var button = new wx.popup.BUTTON(); button.SetButton(wx.GetLanguage('title-cancel'), 'js@wx.popup.Hide();', wx.key.ESC); var content = ''; content += '
' + wx.GetLoading(true) + '
'; content += ''; wx.popup.Show(content, field.title, button, false, true); var url = ((wx.config.type != 'site') ? '/' + wx.config.type : '') + '/report/'; url += 'type,' + wx.report.type + '/field,' + field.field + '/id,' + this.id + '/'; url += 'action,' + action + '/group,' + group + '/index,' + index + '/'; wx.Post(data, url, this.id + 'FRAME'); }; this.Submit = function (field) { this.Post(field, 'submit', 0, 0, []); }; this.SetValue = function (action, group, index, field, value) { var data = wx.report.report; if (value && wx.report.GetField(field)) { if (action == 'submit') data[data.length] = [{field: field, value: value}]; else { if (data[group] && data[group][index]) data[group][index].value = value; }} var object = false; if (object = document.getElementById(this.id + 'FRAME')) object.src = 'about:blank'; wx.report.report = data; this.Show(); wx.popup.Hide(); }; this.GetView = function (view, array) { if (!array) return (view ? (wx.STRING.Check(view, '#0aA-', ' ') ? '' + view + '' : view) : ' '); var data = ''; for (var v=0; v'; data += '
' + view[v] + '
'; } return data; }; this.GetString = function (value) { var string = ''; var list = []; for (var v=0; v'; list = value[v]; for (var l=0; l'; string += value[v][l].field + ':' + value[v][l].value.value; string += '<1:' + l + ':1>'; } string += '<0:' + v + ':0>'; } return string; }; this.GroupValue = function (group, index, change) { wx.tooltip.Hide(); var data = wx.report.report; if (change == 'N') { if (!data[group] || !data[group][index]) return; data[data.length] = [data[group][index]]; } else { if (!data[group] || !data[group][index] || !data[change]) return; data[change][data[change].length] = data[group][index]; } this.DeleteValue(group, index); }; this.EditValue = function (group, index) { wx.tooltip.Hide(); var data = wx.report.report; if (!data[group] || !data[group][index]) return; data = data[group][index]; this.Post(data.field, 'edit', group, index, [['value', data.value.value]]); }; this.DeleteValue = function (group, index) { wx.tooltip.Hide(); var data = wx.report.report; if (!data[group] || !data[group][index]) return; var value = []; var length = 0; for (var d=0; d 1) || ((data.length == 1) && (data[0].length > 1))); content += '
'; content += ''; for (var d=0; d'); content += ''; list = data[d]; for (var l=0; l'; action.del = ''; action.grp = ''; action.grp += ''; content += ''; content += ''; content += ''; content += (group ? '' : ''); content += ''; content += ''; content += ''; } } content += '
 
' + wx.GetLanguage('title-group') + ' ' + wx.NUMBER.Change(d + 1) + '
' + (field ? field.title : ' ') + '' + data[d][l].value.option + '' + view + '' + action.grp + '' + action.edt + '' + action.del + '
'; document.getElementById(this.id + 'VIEW').innerHTML = content; }; }; this.ORDER = new function () { this.id = 'idReportORDER'; this.UpValue = function (index) { var order = wx.report.order; if ((index < 1) || !order[index]) return; var temp = order[index]; order[index] = order[index - 1]; order[index - 1] = temp; wx.report.order = order; wx.report.ORDER.Show(); }; this.Show = function () { var object = document.getElementById(this.id); if (!object) return; var field = wx.report.field; var list = []; var data = wx.report.order; var order = []; var check = false; for (var d=0; d 1); content += '
'; content += ''; for (var o=0; o'; select = ''; select += ''; content += ''; content += ''; content += ''; content += (action ? '' : ''); content += ''; } content += '
' + wx.NUMBER.Change(o + 1) + '' + field.title + '' + select + '' + ((o == 0) ? ' ' : up) + '
'; wx.report.order = value; object.value = value.join('|'); document.getElementById(this.id + 'VIEW').innerHTML = content; }; }; this.VIEW = new function () { this.id = 'idReportVIEW'; this.UpValue = function (index) { var view = wx.report.view; if ((index < 1) || !view[index]) return; var temp = view[index]; view[index] = view[index - 1]; view[index - 1] = temp; wx.report.view = view; wx.report.VIEW.Show(); }; this.Show = function () { var object = document.getElementById(this.id); if (!object) return; var field = wx.report.field; var list = []; var data = wx.report.view; var view = []; var check = false; for (var d=0; d 1); content += '
'; content += ''; for (var v=0; v'; option = ''; content += ''; content += ''; content += (action ? '' : ''); content += ''; } content += '
' + option + '' + field.title + '' + ((v == 0) ? ' ' : up) + '
'; wx.report.view = value; object.value = value.join('|'); document.getElementById(this.id + 'VIEW').innerHTML = content; }; }; this.type = ''; this.field = []; this.report = []; this.order = []; this.view = []; this.SetData = function (type, field, report, order, view) { this.type = type; this.field = field; this.report = report; this.REPORT.Show(); this.order = order; this.ORDER.Show(); this.view = view; this.VIEW.Show(); }; this.GetField = function (field) { for (var f=0; f' + wx.GetLoading(true) + ''; content += ''; wx.popup.Show(content, this.structure[id].title, button, false, true); var url = ((wx.config.type != 'site') ? '/' + wx.config.type : '') + '/structure/'; url += 'structure,' + this.structure[id].structure + '/id,' + id + '/'; url += 'action,' + action + '/index,' + index + '/'; wx.Post(data, url, id + 'FRAME'); }; this.Submit = function (id) { if (!this.structure[id]) return; var structure = this.structure[id]; if (structure.maximum && (structure.value.length >= structure.maximum)) { document.getElementById(id + 'BUTTON').className = 'cJSButtonDisabled'; return; } this.Post(id, 'submit', 0, []); }; this.SetValue = function (id, action, index, value) { if (!this.structure[id]) return; var data = this.structure[id].value; if (action == 'submit') data[data.length] = value; else if (data[index]) data[index] = value; var object = false; if (object = document.getElementById(id + 'FRAME')) object.src = 'about:blank'; this.structure[id].value = data; this.Show(id); wx.popup.Hide(); }; this.GetValue = function (field, value) { for (var v=0; v' + view + '' : view) : ' '); var data = ''; for (var v=0; v'; data += '
' + view[v] + '
'; } return data; }; this.GetString = function (value) { var data = ''; for (var v=0; v'; for (var i=0; i' + value[v][i].value + '<1:' + value[v][i].field + ':1>'; data += '<0:' + v + ':0>'; } return data; }; this.UpValue = function (id, index) { wx.tooltip.Hide(); if (!this.structure[id]) return; var value = this.structure[id].value; if (!index || (index == 0) || (index > (value.length - 1))) return; var temp = value[index]; value[index] = value[index - 1]; value[index - 1] = temp; this.structure[id].value = value; this.Show(id); }; this.EditValue = function (id, index) { wx.tooltip.Hide(); if (!this.structure[id]) return; var value = this.structure[id].value; if ((index < 0) || (index > (value.length - 1))) return; value = value[index]; var data = []; var field = this.structure[id].field; for (var f=0; f= structure.maximum)); document.getElementById(id + 'BUTTON').className = 'cJSButton' + (full ? 'Disabled' : ''); document.getElementById(id + 'VIEW').style.display = ((structure.value.length == 0) ? 'none' : ''); if (structure.value.length == 0) return; var field = structure.field; var width = []; for (var f=0; f 1)); var total = 90 - (structure.index ? 5 : 0) - (order ? 5 : 0); width = wx.NUMBER.Percent(width, total); var title = ''; title += '' + (structure.index ? ' ' : ''); for (var f=0; f' + field[f].title + ''; title += (order ? ' ' : ''); title += ' '; title += ' '; var content = ''; var style = ''; var action = {ord: '', edt: '', del: ''}; content += '
'; content += '' + title; for (var v=0; v'); action.edt = ''; action.del = ''; content += ''; content += (structure.index ? '' : ''); for (var f=0; f' + this.GetView(structure.value[v], field[f].field) + ''; content += (order ? '' : ''); content += ''; content += ''; } content += '
' + wx.NUMBER.Change(v + 1) + '' + action.ord + '' + action.edt + '' + action.del + '
'; document.getElementById(id + 'VIEW').innerHTML = content; }; this.Check = function (form) { if (!this.form[form]) return; var structure = this.form[form]; var value = []; var minimum = 0; var maximum = 0; var error = []; for (var s=0; s', wx.NUMBER.Change(minimum)); maximum = this.structure[structure[s].id].maximum; if (maximum && (value.length > maximum)) error[error.length] = wx.GetLanguage('field-help-structure-maximum').replace('<-VALUE->', wx.NUMBER.Change(maximum)); document.getElementById(structure[s].id + 'ERROR').style.display = ((error.length == 0) ? 'none' : ''); if (error.length == 0) return; document.getElementById(structure[s].id + 'ERROR').innerHTML = '- ' + error.join('
- '); wx.form.error = true; if (!wx.form.focus) { wx.content.TAB.SetPage(form + 'TAB', structure[s].tab); try { document.getElementById(structure[s].id + 'BUTTON').focus(); wx.form.focus = true; } catch (e) { wx.form.focus = false; }; } } }; }; WEBILIX.prototype.calendar = new function() { this.calendar = []; this.SetCalendar = function (calendar, date, view, action) { this.calendar[calendar] = {date: date, view: view, action: action, button: []}; }; this.SetButton = function (calendar, title, action, key) { if (!this.calendar[calendar]) return; var index = this.calendar[calendar].button.length; this.calendar[calendar].button[index] = {title: title, action: action, key: key}; }; this.ChangeYear = function (date, change) { var year = date.substr(0, 4); year = parseInt(year, 10); var month = date.substr(5, 2); month = parseInt(month, 10); return (year + change).toString() + '-' + ((month < 10) ? '0' : '') + month.toString() + '-13'; }; this.ChangeMonth = function (date, change) { var year = date.substr(0, 4); year = parseInt(year, 10); var month = date.substr(5, 2); month = parseInt(month, 10); month += change; if (month > 12) { month = 1; year++; } else if (month < 1) { month = 12; year --; } return year.toString() + '-' + ((month < 10) ? '0' : '') + month.toString() + '-13'; }; this.ShowCalendar = function (id, date) { if (!this.calendar[id]) return; var calendar = this.calendar[id]; var list = calendar.button; if (list.length == 0) var button = false; else { var button = new wx.popup.BUTTON(); for (var l=0; l<<'; view += '<'; view += '' + month[parseInt(date.substr(5, 2), 10) - 1] + ' ' + wx.NUMBER.Change(date.substr(0, 4), true) + ''; view += '>'; view += '>>'; view += ''; for (var n=0; n<7; n++) view += '' + name[n] + ''; view += ''; while (((data.start <= data.end) && (index < 42)) || ((index % 7) != 0)) { date = wx.date.GetDate(data.start); style = ((date.substr(0, 8) == check) ? 'cCalendarDAY' : 'cCalendarEXTRA'); if (date == wx.date.GetDate()) style = 'cCalendarTODAY'; todo = (calendar.action && (style != 'cCalendarEXTRA')); var yVal = wx.NUMBER.Change(date.substr(0, 4), true); var mVal = month[parseInt(date.substr(5, 2), 10) - 1]; var dVal = wx.NUMBER.Change(date.substr(8, 2), true); var value = dname[index % 7] + ' - ' + dVal + ' ' + mVal + ' ' + yVal; view += (((index % 7) == 0) ? '' : '') + '' + (((index % 7) == 6) ? '' : ''); data.start.setDate(data.start.getDate() + 1); index++; } view += '' + (button ? '
' + button + '
' : ''); document.getElementById(calendar.view).innerHTML = view; }; }; WEBILIX.prototype.form = new function () { this.MEMBER = new function () { this.member = []; this.SetMember = function (id, type, multiple, index, order, value) { this.member[id] = {type: type, multiple: multiple, index: index, order: order, value: value}; this.Show(id); }; this.Submit = function (id, type, search, page) { if (!this.member[id]) return; var member = this.member[id]; var data = [['id', id], ['list', member.type], ['type', (type ? type : '')]]; if (search) data[data.length] = ['search', search]; var value = []; for (var v=0; v 0) data[data.length] = ['value', value.join('|')]; wx.popup.LoadAJAX('member-list', data, false, (page ? page : 1)); }; this.Exists = function (id, code) { if (!this.member[id]) return; var value = this.member[id].value; for (var v=0; v 1); var width = wx.ARRAY.Percent([65, 35], 95 - (index ? 5 : 0) - (order ? 5: 0)); var up = ''; var del = ''; var content = ''; content += '
'; content += ''; var code = []; var style = ''; for (var v=0; v' + wx.NUMBER.Change(v + 1) + '' : ''); content += ''; content += ''; content += (order ? '' : ''); content += ''; content += ''; } content += '
' + value[v].name + '' + value[v].type + '' + ((v == 0) ? ' ' : up.replace('<-INDEX->', v)) + '' + del.replace('<-INDEX->', v) + '
'; document.getElementById(id).value = ((value.length == 0) ? '' : '|' + code.join('|') + '|'); document.getElementById(id + 'VIEW').innerHTML = ((value.length == 0) ? '' : content); }; }; this.MSELECT = new function () { this.Check = function (id, item) { var value = []; for (var i=0; i max) object.value = max; }; this.Change = function (id, min, max, change) { if (!this.active || !change || (change == 0)) return; var object = document.getElementById(id); if (!object) return; if (!object.value || !wx.STRING.Check(object.value, '0')) object.value = min; var value = parseInt(object.value, 10); value += parseInt(change / 5, 10); if (change > 0) change++; else change--; if (value < min) value = min; else if (value > max) value = max; object.value = value; window.setTimeout('wx.form.NSELECT.Change(\'' + id + '\', ' + min + ', ' + max + ', ' + change + ');', 100); }; }; this.RADIO = new function () { this.Check = function (id, item, count) { for (var i=0; i 1)) value = [value[0]]; this.upload[id] = {multiple: multiple, order: order, value: value}; this.Show(id); }; this.Set = function (id, file, title, download) { wx.popup.Hide(); if (!this.upload[id]) return; var value = this.upload[id].value; var data = {file: file, title: title, download: download}; if (this.upload[id].multiple) value[value.length] = data; else value = [data]; this.upload[id].value = value; this.Show(id); }; this.Up = function (id, item) { if (!this.upload[id]) return; var value = this.upload[id].value; if ((item == 0) || !value[item]) return; var temp = ''; temp = value[item]; value[item] = value[item - 1]; value[item - 1] = temp; this.upload[id].value = value; this.Show(id); }; this.Delete = function (id, item) { if (!this.upload[id]) return; var value = this.upload[id].value; var list = []; for (var v=0; v' + data.value[v].title + ''; view += (data.order ? '' + ((v == 0) ? ' ' : '') + '' : ''); view += ''; } view += ''; document.getElementById(id).value = ((value.length != 0) ? '|' + value.join('|') + '|' : ''); document.getElementById(id + 'VIEW').innerHTML = ((value.length != 0) ? view : ' '); }; }; this.FOLDER = new function () { this.dir = ''; this.Cancel = function (id) { var obj = null; if (obj = document.getElementById(id)) obj.value = ''; if (obj = document.getElementById(id + 'VIEW')) obj.innerHTML = ' '; }; this.Submit = function (id, image, search, page) { var obj = document.getElementById(id); if (!obj) return; var data = [['id', id], ['image', image], ['dir', this.dir]]; if (search) data[data.length] = ['search', search]; wx.popup.LoadAJAX('folder-list', data, false, (page ? page : 1)); }; this.SetValue = function (id, value, download) { var obj = document.getElementById(id); if (!obj) return; wx.popup.Hide(); obj.value = value; document.getElementById(id + 'VIEW').innerHTML = '' + value + ''; }; }; this.FILE = new function () { this.Cancel = function (id) { var obj = null; if (obj = document.getElementById(id)) obj.value = ''; if (obj = document.getElementById(id + 'VIEW')) obj.innerHTML = ' '; }; this.Submit = function (id, group, page) { var obj = document.getElementById(id); if (!obj) return; var data = [['id', id], ['group', group]]; wx.popup.LoadAJAX('file-list', data, false, (page ? page : 1)); }; this.SetValue = function (id, value, name) { var obj = document.getElementById(id); if (!obj) return; wx.popup.Hide(); obj.value = value; document.getElementById(id + 'VIEW').innerHTML = '' + name + ''; }; }; this.VALUE = new function () { this.type = []; this.SetType = function (type) { var data = false; var d=0; var list = []; var field = []; for (var t=0; t=0; l--) { amount = ((total < field[list[l]].total) ? 0 : parseInt((total / field[list[l]].total), 10)); value[list[l]] = amount; total -= (amount * field[list[l]].total); } return value; }; this.GetView = function (type, value) { var field = this.GetType(type, 'field'); value = this.GetValue(type, value); var view = []; var list = this.GetType(type, 'list'); for (var l=list.length - 1; l>=0; l--) { if (!value[list[l]]) continue; var title = field[list[l]].title; view[view.length] = wx.NUMBER.Change(value[list[l]]) + ' ' + title; } return view.join(' ' + wx.GetLanguage('title-and') + ' '); }; this.SetValue = function (id, type) { var field = this.GetType(type, 'field'); if (!document.getElementById(id) || !field) return; var list = this.GetType(type, 'list'); var value = 0; var error = false; for (var l=0; l field[list[l]].max)) check = false; if (check) value += field[list[l]].total * parseInt(item.value, 10); else { item.className = 'cFormObjectVALUEERROR'; item.focus(); error = true; } } if (error) return; document.getElementById(id).value = (value ? value : ''); document.getElementById(id + 'VIEW').innerHTML = (value ? this.GetView(type, value) : ' '); document.getElementById(id + 'FORM').style.display = 'none'; }; this.Submit = function (id, type, list) { var field = this.GetType(type, 'field'); if (!document.getElementById(id) || !field) return; var value = document.getElementById(id).value; value = this.GetValue(type, (value ? parseInt(value, 10) : 0)); var button = new wx.popup.BUTTON(); button.SetButton(wx.GetLanguage('title-submit'), 'js@wx.form.VALUE.SetValue(\'' + id + '\', \'' + type + '\');'); button.SetButton(wx.GetLanguage('title-cancel'), 'js@document.getElementById(\'' + id + 'FORM\').style.display = \'none\';'); button = button.GetButton('center'); var form = ''; var action = ''; form += '
'; for (var l=list.length - 1; l>=0; l--) { if (!field[list[l]]) continue; var data = field[list[l]]; action = ((l == 0) ? 'wx.form.VALUE.SetValue(\'' + id + '\', \'' + type + '\');' : 'document.getElementById(\'' + id + 'Item' + list[l - 1] + '\').focus();'); form += ''; form += ''; } form += '
 ' + data.title + '
' + button + '
'; var object = document.getElementById(id + 'FORM'); object.innerHTML = form; object.style.display = ''; document.getElementById(id + 'Item' + list[list.length - 1]).focus(); }; this.Cancel = function (id) { var object = document.getElementById(id); if (!object) return; object.value = ''; document.getElementById(id + 'VIEW').innerHTML = ' '; document.getElementById(id + 'FORM').style.display = 'none'; }; }; this.LIST = new function () { this.list = []; this.SetList = function (id, list, title, dir, index, order, value) { this.list[id] = {list: list, title: title, dir: dir, index: index, order: order, value: value}; this.Show(id); }; this.ShowError = function (id, message) { var error = document.getElementById(id + 'ITEMERROR'); if (!this.list[id] || !error) return; error.innerHTML = message; error.style.display = (message ? '' : 'none'); document.getElementById(id + 'ITEM').focus(); }; this.Exists = function (id, item) { if (!this.list[id]) return false; var value = this.list[id].value; for (var v=0; v'; content += ''; var title = (list.title ? list.title : wx.GetLanguage('title-submit')); wx.popup.Show(content, title, button); document.getElementById(id + 'ITEM').focus(); } }; this.Set = function (id, item) { if (!this.list[id]) return; var value = this.list[id].value; value[value.length] = item; this.list[id].value = value; this.Show(id); }; this.Up = function (id, item) { if (!this.list[id]) return; var value = this.list[id].value; if ((item == 0) || !value[item]) return; var temp = ''; temp = value[item]; value[item] = value[item - 1]; value[item - 1] = temp; this.list[id].value = value; this.Show(id); }; this.Delete = function (id, item) { if (!this.list[id]) return; var value = this.list[id].value; var list = []; for (var v=0; v 1)) ? 10 : 0); content += '
'; for (var v=0; v' + wx.NUMBER.Change(v + 1) + '' : ''); content += ''; if (list.order && (value.length > 1)) { content += ''; } content += ''; content += ''; } content += '
 ' + (en ? '' : '') + value[v] + (en ? '' : '') + '' + ((v == 0) ? ' ' : '') + '
'; view.innerHTML = content; }; }; this.DATE = new function () { this.Submit = function (id) { var object = document.getElementById(id); if (!object) return; var calendar = document.getElementById(id + 'CALENDAR'); calendar.style.display = ''; wx.calendar.SetCalendar(id, object.value, id + 'CALENDAR', 'wx.form.DATE.SetDate(\'' + id + '\', \'<-DATE->\');'); wx.calendar.SetButton(id, wx.GetLanguage('title-cancel'), 'js@document.getElementById(\'' + id + 'CALENDAR\').style.display = \'none\';', wx.key.ESC); wx.calendar.ShowCalendar(id); }; this.SetDate = function (id, value) { var object = document.getElementById(id); if (!object) return; object.value = value; var view = document.getElementById(id + 'VIEW'); view.innerHTML = wx.date.GetView(value); var calendar = document.getElementById(id + 'CALENDAR'); calendar.style.display = 'none'; }; this.Cancel = function (id) { var object = document.getElementById(id); if (!object) return; object.value = ''; var view = document.getElementById(id + 'VIEW'); view.innerHTML = ' '; var calendar = document.getElementById(id + 'CALENDAR'); calendar.style.display = 'none'; } }; this.TIME = new function () { this.Check = function (id) { var time = document.getElementById(id); if (!time) return; time.value = ''; var list = ['H', 'M', 'S']; var obj = false; var value = []; var data = 0; for (var l=0; l 23)) obj.value = '23'; else if (data > 59) obj.value = '59'; else obj.value = ((data < 10) ? '0' : '') + data; } if (obj.value) value[value.length] = obj.value; } if (value.length == 3) time.value = value.join(':'); }; }; this.ORDER = new function () { this.order = []; this.Set = function (id, field) { this.order[id] = field; this.Show(id); }; this.Up = function (id, index) { if (!this.order[id] || !index) return; var field = this.order[id]; if (!field[index]) return; var temp = field[index]; field[index] = field[index - 1]; field[index - 1] = temp; this.order[id] = field; this.Show(id); }; this.Order = function (id, index, order) { if (!this.order[id]) return; var field = this.order[id]; if (!field[index]) return; field[index].type = order; this.order[id] = field; this.Show(id); }; this.Show = function (id) { if (!this.order[id]) return; var field = this.order[id]; var content = ''; var value = []; var style = ''; var up = ''; up += ');" />'; var order = 'wx.form.ORDER.Order(\'' + id + '\', <-INDEX->, this.value);'; content += '
'; content += ''; for (var f=0; f' + wx.NUMBER.Change(f + 1) + ''; content += ''; content += ''; } content += '
' + field[f].title + ''; content += ''; content += ((f != 0) ? up.replace('<-INDEX->', f) : '') + '
'; document.getElementById(id).value = value.join('|'); document.getElementById(id + 'VIEW').innerHTML = content; }; }; this.COUNT = new function () { this.Line = function (id) { var obj = document.getElementById(id); if (!obj) return; var line = obj.value.split('\n'); while ((line.length > 0) && line[line.length - 1].replace('\n', '').replace('\r', '').replace('\t', '') == '') line.pop(); document.getElementById(id + 'COUNT').innerHTML = wx.NUMBER.Change(line.length); }; }; this.CHECK = new function () { this.CheckObject = function (value, check) { var error = []; for (var c=0; c', list.join(' ' + wx.GetLanguage('title-and') + ' ')); }} else if (check[c].substr(0, 5) == 'char,') { var use = check[c].substr(5); var list = []; if (!wx.STRING.Check(value, use)) { for (var u=0; u', list.join(' ' + wx.GetLanguage('title-and') + ' ')); }} else if (check[c].substr(0, 6) == 'count,') { var count = parseInt(check[c].substr(6), 10); var list = wx.STRING.Explode(value); if (list.length < count) error[error.length] = wx.GetLanguage('field-help-count').replace('<-COUNT->', wx.NUMBER.Change(count)); } else if (check[c].substr(0, 8) == 'between,') { var length = check[c].substr(8).split('-'); var min = parseInt(length[0], 10); var max = parseInt(length[1], 10); if (!parseInt(value, 10) || (parseInt(value, 10) < min) || (parseInt(value, 10) > max)) { min = wx.NUMBER.Change(min); max = wx.NUMBER.Change(max); error[error.length] = wx.GetLanguage('field-help-between').replace('<-MIN->', min).replace('<-MAX->', max); }} else if (check[c].substr(0, 8) == 'minimum,') { var min = parseInt(check[c].substr(8), 10); if (!parseInt(value, 10) || (parseInt(value, 10) < min)) error[error.length] = wx.GetLanguage('field-help-minimum').replace('<-VALUE->', wx.NUMBER.Change(min)); } else if (check[c].substr(0, 8) == 'maximum,') { var max = parseInt(check[c].substr(8), 10); if (!parseInt(value, 10) || (parseInt(value, 10) > max)) error[error.length] = wx.GetLanguage('field-help-maximum').replace('<-VALUE->', wx.NUMBER.Change(max)); } else if (check[c].substr(0, 7) == 'length,') { var length = check[c].substr(7).split('-'); var min = parseInt(length[0], 10); var max = parseInt(length[1], 10); if ((value.length < min) || (value.length > max)) { min = wx.NUMBER.Change(min); max = wx.NUMBER.Change(max); error[error.length] = wx.GetLanguage('field-help-length').replace('<-MIN->', min).replace('<-MAX->', max); }} else if (check[c].substr(0, 7) == 'minlen,') { var length = parseInt(check[c].substr(7), 10); if (value.length < length) error[error.length] = wx.GetLanguage('field-help-minlen').replace('<-LENGTH->', wx.NUMBER.Change(length)); } else if (check[c].substr(0, 7) == 'maxlen,') { var length = parseInt(check[c].substr(7), 10); if (value.length > length) error[error.length] = wx.GetLanguage('field-help-maxlen').replace('<-LENGTH->', wx.NUMBER.Change(length)); } } } return ((error.length == 0) ? false : '- ' + error.join('
- ')); }; this.Check = function (form, check) { for (var c=0; c