Unified AJAX endpoints
authorAlexander Ebert <ebert@woltlab.com>
Tue, 16 Aug 2016 22:41:15 +0000 (00:41 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 16 Aug 2016 22:41:20 +0000 (00:41 +0200)
com.woltlab.wcf/templates/headIncludeJavaScript.tpl
wcfsetup/install/files/acp/templates/header.tpl
wcfsetup/install/files/js/WCF.Message.js
wcfsetup/install/files/js/WCF.Poll.js
wcfsetup/install/files/js/WCF.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ajax.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js
wcfsetup/install/files/js/WoltLabSuite/Core/Upload.js

index 2971d951b2accf590dc1adc396e64527e9a4ef8b..91f9d6b09f7466ef82ea24e781f0ccc4e15a6f13 100644 (file)
@@ -5,10 +5,11 @@
 <script>
        var SID_ARG_2ND = '';
        var WCF_PATH = '{@$__wcf->getPath()}';
+       var WSC_API_URL = '{@$__wcf->getPath()}';
        var SECURITY_TOKEN = '{@SECURITY_TOKEN}';
        var LANGUAGE_ID = {@$__wcf->getLanguage()->languageID};
        var TIME_NOW = {@TIME_NOW};
-       var URL_LEGACY_MODE = {if URL_LEGACY_MODE}true{else}false{/if};
+       var URL_LEGACY_MODE = false;
 </script>
 
 {js application='wcf' file='require' bundle='WoltLabSuite.Core' core='true'}
index fdb3a3074ddb328dc9903629434150e4b7d2a22b..6321d46f81c85545599240970895c5d3e4993e66 100644 (file)
@@ -18,7 +18,7 @@
        <script>
                var SID_ARG_2ND = '';
                var WCF_PATH = '{@$__wcf->getPath()}';
-               var WSC_IS_ACP = true;
+               var WSC_API_URL = '{@$__wcf->getPath()}acp/';
                var SECURITY_TOKEN = '{@SECURITY_TOKEN}';
                var LANGUAGE_ID = {@$__wcf->getLanguage()->languageID};
                var TIME_NOW = {@TIME_NOW};
index 20e539314419cdf5fbf4c7c5eb8c377fa7a0cf64..ea4ddc05b7e37c1a621013112200e0085cec9619 100644 (file)
@@ -1598,7 +1598,7 @@ WCF.Message.Quote.Manager = Class.extend({
                this._proxy = new WCF.Action.Proxy({
                        showLoadingOverlay: false,
                        success: $.proxy(this._success, this),
-                       url: 'index.php/MessageQuote/?t=' + SECURITY_TOKEN
+                       url: 'index.php?message-quote/&t=' + SECURITY_TOKEN
                });
                
                this._toggleShowQuotes();
index 62d3568414adaffc3ad949b138a65141ebce5faa..e1194d32779d50f661490de2c3f08600c07d051d 100644 (file)
@@ -364,7 +364,7 @@ WCF.Poll.Manager = Class.extend({
                this._polls = { };
                this._proxy = new WCF.Action.Proxy({
                        success: $.proxy(this._success, this),
-                       url: 'index.php/Poll/?t=' + SECURITY_TOKEN
+                       url: 'index.php?poll/&t=' + SECURITY_TOKEN
                });
                
                // init polls
index de998f50f93c7849fbefb535d57641180f436d5b..2361562861eb024ed11a99471eca5ecacad6d70f 100755 (executable)
@@ -1489,7 +1489,7 @@ WCF.Action.Proxy = Class.extend({
                        success: null,
                        suppressErrors: false,
                        type: 'POST',
-                       url: 'index.php/AJAXProxy/?t=' + SECURITY_TOKEN,
+                       url: 'index.php?ajax-proxy/&t=' + SECURITY_TOKEN,
                        aborted: null,
                        autoAbortPrevious: false
                }, options);
@@ -6009,7 +6009,7 @@ WCF.Upload = Class.extend({
                this._options = $.extend(true, {
                        action: 'upload',
                        multiple: false,
-                       url: 'index.php/AJAXUpload/?t=' + SECURITY_TOKEN
+                       url: 'index.php?ajax-upload/&t=' + SECURITY_TOKEN
                }, options || { });
                
                this._options.url = WCF.convertLegacyURL(this._options.url);
index 4f38e2ef7b6035c4019ef317f7f77b442cd82844..c5846733f9e24114f18f13675577dc71d3e30c37 100644 (file)
@@ -39,7 +39,7 @@ define(['AjaxRequest', 'Core', 'ObjectMap'], function(AjaxRequest, Core, ObjectM
                                options.pinData = true;
                                options.callbackObject = callbackObject;
                                
-                               if (!options.url) options.url = 'index.php/AJAXProxy/?t=' + SECURITY_TOKEN;
+                               if (!options.url) options.url = 'index.php?ajax-proxy/&t=' + SECURITY_TOKEN;
                                
                                request = new AjaxRequest(options);
                                
@@ -82,7 +82,7 @@ define(['AjaxRequest', 'Core', 'ObjectMap'], function(AjaxRequest, Core, ObjectM
                        
                        options.pinData = false;
                        options.callbackObject = null;
-                       if (!options.url) options.url = 'index.php/AJAXProxy/?t=' + SECURITY_TOKEN;
+                       if (!options.url) options.url = 'index.php?ajax-proxy/&t=' + SECURITY_TOKEN;
                        
                        var request = new AjaxRequest(options);
                        request.sendRequest();
index f5d09fc8a96975232bb95a475a7d37d6405c59f5..8dd9593f491190a9baa585d2ca8825da9649c535 100644 (file)
@@ -62,7 +62,7 @@ define(['Core', 'Language', 'Dom/ChangeListener', 'Dom/Util', 'Ui/Dialog', 'Wolt
                        
                        this._options.url = Core.convertLegacyUrl(this._options.url);
                        if (this._options.url.indexOf('index.php') === 0) {
-                               this._options.url = WCF_PATH + (window.WSC_IS_ACP === true ? 'acp/' : '') + this._options.url;
+                               this._options.url = WSC_API_URL + this._options.url;
                        }
                        
                        if (this._options.pinData) {
index 958c83f8f3161a45d5dd42df21a48d37a2ae77bc..52b1fffe489110cd7c40cbcc192ef0744b9ecfb5 100644 (file)
@@ -2,7 +2,7 @@
  * Uploads file via AJAX.
  * 
  * @author     Matthias Schmidt
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @module     WoltLabSuite/Core/Upload
  */
@@ -30,10 +30,13 @@ define(['AjaxRequest', 'Core', 'Dom/ChangeListener', 'Language', 'Dom/Util', 'Do
                        // is true if every file from a multi-file selection is uploaded in its own request
                        singleFileRequests: false,
                        // url for uploading file
-                       url: 'index.php/AJAXUpload/?t=' + SECURITY_TOKEN
+                       url: 'index.php?ajax-upload/&t=' + SECURITY_TOKEN
                }, options);
                
-               this._options.url = WCF.convertLegacyURL(this._options.url);
+               this._options.url = Core.convertLegacyUrl(this._options.url);
+               if (this._options.url.indexOf('index.php') === 0) {
+                       this._options.url = WSC_API_URL + this._options.url;
+               }
                
                this._buttonContainer = elById(buttonContainerId);
                if (this._buttonContainer === null) {