| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- /**
- * Copyright (c) UNA, Inc - https://una.io
- * MIT License - https://opensource.org/licenses/MIT
- *
- * @defgroup UnaStudio UNA Studio
- * @{
- */
- function BxDolStudioSettings(oOptions) {
- this.sActionsUrl = oOptions.sActionUrl;
- this.sObjName = oOptions.sObjName == undefined ? 'oBxDolStudioSettings' : oOptions.sObjName;
- this.sType = oOptions.sType == undefined ? '' : oOptions.sType;
- this.sCategory = oOptions.sCategory == undefined ? '' : oOptions.sCategory;
- this.sMix = oOptions.sMix == undefined ? '' : oOptions.sMix;
- this.sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
- this.iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
- }
- BxDolStudioSettings.prototype.mixSelect = function(oSelect) {
- var $this = this;
- var oDate = new Date();
- $.post(
- sUrlStudio + 'settings.php',
- {
- page: this.sType,
- category: this.sCategory,
- stg_action: 'select-mix',
- stg_value: $(oSelect).val(),
- _t:oDate.getTime()
- },
- function (oData) {
- $this.processResult(oData);
- },
- 'json'
- );
- };
- BxDolStudioSettings.prototype.onMixSelect = function(oData) {
- document.location.href = document.location.href;
- };
- BxDolStudioSettings.prototype.mixCreate = function(oButton) {
- var $this = this;
- var oDate = new Date();
- $('.bx-popup-applied:visible').dolPopupHide();
- $.post(
- sUrlStudio + 'settings.php',
- {
- page: this.sType,
- category: this.sCategory,
- stg_action: 'create-mix',
- _t:oDate.getTime()
- },
- function (oData) {
- $this.processResult(oData);
- },
- 'json'
- );
- };
- BxDolStudioSettings.prototype.onMixCreate = function(oData) {
- document.location.href = document.location.href;
- };
- BxDolStudioSettings.prototype.mixImport = function(oButton) {
- var $this = this;
- var oDate = new Date();
- $.post(
- sUrlStudio + 'settings.php',
- {
- page: this.sType,
- category: this.sCategory,
- stg_action: 'import-mix',
- _t:oDate.getTime()
- },
- function (oData) {
- $this.processResult(oData);
- },
- 'json'
- );
- };
- BxDolStudioSettings.prototype.onMixImport = function(oData) {
- document.location.href = document.location.href;
- };
- BxDolStudioSettings.prototype.mixExport = function(oButton, iId) {
- var $this = this;
- var oDate = new Date();
- $.post(
- sUrlStudio + 'settings.php',
- {
- page: this.sType,
- category: this.sCategory,
- stg_action: 'export-mix',
- stg_value: iId,
- _t:oDate.getTime()
- },
- function (oData) {
- $this.processResult(oData);
- },
- 'json'
- );
- };
- BxDolStudioSettings.prototype.onMixExport = function(oData) {
- document.location.href = oData.url;
- };
- BxDolStudioSettings.prototype.mixDelete = function(oButton, iId) {
- var $this = this;
- var oDate = new Date();
- $.post(
- sUrlStudio + 'settings.php',
- {
- page: this.sType,
- category: this.sCategory,
- stg_action: 'delete-mix',
- stg_value: iId,
- _t:oDate.getTime()
- },
- function (oData) {
- $this.processResult(oData);
- },
- 'json'
- );
- };
- BxDolStudioSettings.prototype.onMixDelete = function(oData) {
- document.location.href = document.location.href;
- };
- /**
- * Is needed if AJAX is used to change (reload) pages.
- */
- BxDolStudioSettings.prototype.changePage = function(sType) {
- var oDate = new Date();
- var $this = this;
- $.get(
- this.sActionsUrl,
- {
- stg_action: 'get-page-by-type',
- stg_value: sType,
- _t:oDate.getTime()
- },
- function(oData) {
- if(oData.code != 0) {
- alert(oData.message);
- return;
- }
- $('#bx-std-pc-menu > .bx-std-pmi-active').removeClass('bx-std-pmi-active');
- $('#bx-std-pmi-' + sType).addClass('bx-std-pmi-active');
- $('#bx-std-pc-content').bx_anim('hide', $this.sAnimationEffect, $this.iAnimationSpeed, function() {
- $(this).html(oData.content).bx_anim('show', $this.sAnimationEffect, $this.iAnimationSpeed);
- });
- },
- 'json'
- );
- return true;
- };
- BxDolStudioSettings.prototype.processResult = function(oData) {
- var $this = this;
- if(oData && oData.message != undefined && oData.message.length != 0)
- alert(oData.message);
- if(oData && oData.reload != undefined && parseInt(oData.reload) == 1)
- document.location = document.location;
- if(oData && oData.popup != undefined) {
- var oPopup = $(oData.popup).hide();
- $('#' + oPopup.attr('id')).remove();
- oPopup.prependTo('body').dolPopup({
- fog: {
- color: '#fff',
- opacity: .7
- },
- closeOnOuterClick: false
- });
- }
- if (oData && oData.eval != undefined)
- eval(oData.eval);
- };
- /** @} */
|