托管在实时 Linux 服务器上与 OSX 开发机器上时 KendoUI 上传对话框的差异

发布于 2024-12-04 14:00:34 字数 5761 浏览 9 评论 0原文

我设置了一个简单的表单来使用 KendoUI 上传文件,在我的开发机器 (OSX Apache) 上看起来和工作得很好,但上传到我的服务器 (Linux Apache) 时,它看起来很糟糕,正如您在图像中看到的那样。我在 Firefox 和 Chrome 中测试了相同的结果,本地副本都很好,远程副本都不好。我已经三次检查本地和远程服务器上的所有文件是否相同。

在开发机器上不错 vs “上传后borked”

我的代码如下......

<!doctype html>
<html>
  <head>
    <title>Test | Animation Tool</title>
    <link href="./kendo/styles/kendo.common.min.css" rel="stylesheet"/>
    <link href="./kendo/styles/kendo.kendo.min.css" rel="stylesheet"/>
    <script src="./jquery.js"></script>

    <script src="./kendo/js/kendo.all.min.js"></script>

    <style type="text/css">
      body{
        background-Color: #f78049;
        background-image: url(stripe.png);
        background-repeat: repeat-y;
        margin:0;padding:0;
        font-family:sans-serif;
      }
      #sidebar{
        background-Color: #f78049;
        border: 3px solid #ef652a;
        margin:0;padding:0;
        width: 300px;
        float: left;
        height: 900px;
      }
      .step{
        border-top: 3px solid #ef652a;
      }
      .step p.first{
        display: inline;
      }
      .step-id{
        background-color: #ef652a;
        -moz-border-radius: 7px;
        font-size: 30px;
        margin: .2em .2em .2em 0;
        padding: .1em .2em;
      }
      .t-button{
        margin: 0 37px 0 37px;
        width:203px;
        top: 10px;
      }
      button.t-button{
        margin: .2em 37px .2em 37px;
        width:220px;
      }
      .t-upload-files{
        margin: 0.2em 2.6em 1em;
      }
      #main{
        float:left;
      }
      h1, h2{
        margin:0;padding:0 0 0.3em;
        text-align:center;
        color:#ffd;
      }
      #phone,#anim{
        width:401px;
        height:875px;
        background-image:url(phone.png);
        position: absolute;
        top:10px;
        left:350px;
      }
      #anim{
        background-image:url("files/spec.png");
        background-position:0 0;
        background-repeat:no-repeat;
        height:480px;
        left:391px;
        top:144px;
        width:320px;
      }
      a img{
        border:none;
      }
    </style>
      <script type="text/javascript">
        $(function(){

          var i=0, x={timer:null, frames:4, frameWidth:320, frameRate:150};

          var addTestFile = function(filename){
            $('#test-files').append(
              $('<button />').addClass('t-button custom').html(filename).click(function(){
                $anim = $('#anim').css({backgroundImage:'url("files/'+filename+'")'})
                  var loop = function(){
                    $anim.css({backgroundPosition:"0 0"}).animate({borderWidth:0},150,function(){
                      $anim.css({backgroundPosition:"-320px 0"}).animate({borderWidth:0},150,function(){
                        $anim.css({backgroundPosition:"-640px 0"}).animate({borderWidth:0},150,function(){
                          $anim.css({backgroundPosition:"-960px 0"}).animate({backgroundPosition:"-640px 0"},250,function(){

                          })
                        })
                      })
                    })
                  }
                  clearInterval(x.timer)
                  x.timer = setInterval(function(){
                  loop()
                  }, 950)
              })
            )
          }

          $.get('files.php',function(d){
            $.each(d, function(i,file){
              addTestFile(file)
            })
          })

          $("#files").kendoUpload({
            async: {
              saveUrl: "./save.php",
              // removeUrl: "./remove.php",
              autoUpload: true
            },
            showFileList: true,
            success: function(e){

              $('.t-file').last().siblings().remove()

              var filename = e.files[0].name.replace(/\s/g,'-')

              $('#test-files button').filter(function(){
                return $(this).text() == filename
              }).remove()

              addTestFile(filename)

              console.log('uploaded' + e.files[0].name);
              //              return true;
            },
            error: function(e){
              console.log("Error (" + e.operation + ")");
              e.preventDefault(); // Suppress error message
            }

          });
        });
      </script>
  </head>
  <body>
    <div id="sidebar">
      <h2>Animation Tool</h2>

      <div id='one' class='step'>
        <span class='step-id'>1</span>
        <p class="first">Get the specification image</p>
        <p><a href="getspec.php" class='t-button'>Download image...</a></p>
      </div>

      <div id='two' class='step'>
        <span class='step-id'>2</span>
        <p class="first">Edit the downloaded image file</p>

      </div>

      <div id='three' class='step'>
        <span class='step-id'>3</span>
        <p class="first">Upload your edited file</p>
        <input name="files" id="files" type="file" />
      </div>

      <div id='two' class='step'>
        <span class='step-id'>4</span>
        <p class='first'>Test you animation</p>
        <span id='test-files'></span>
      </div>

    </div>
    <div id="main">
      <div id="anim"></div>
      <div id="phone"></div>
    </div>
  </body>
</html>

I set up a simple form to upload files using KendoUI, and looks and works great on my dev machine (OSX Apache), but uploaded to my server (Linux Apache) it looks bad as you can see in the images. I tested with same results in both firefox and chrome, and both are fine from local copy and bad from remote. I have tripple checked that all the files are the same on both local and remote servers.

nice on dev machine vs borked after upload

My code is as follows...

<!doctype html>
<html>
  <head>
    <title>Test | Animation Tool</title>
    <link href="./kendo/styles/kendo.common.min.css" rel="stylesheet"/>
    <link href="./kendo/styles/kendo.kendo.min.css" rel="stylesheet"/>
    <script src="./jquery.js"></script>

    <script src="./kendo/js/kendo.all.min.js"></script>

    <style type="text/css">
      body{
        background-Color: #f78049;
        background-image: url(stripe.png);
        background-repeat: repeat-y;
        margin:0;padding:0;
        font-family:sans-serif;
      }
      #sidebar{
        background-Color: #f78049;
        border: 3px solid #ef652a;
        margin:0;padding:0;
        width: 300px;
        float: left;
        height: 900px;
      }
      .step{
        border-top: 3px solid #ef652a;
      }
      .step p.first{
        display: inline;
      }
      .step-id{
        background-color: #ef652a;
        -moz-border-radius: 7px;
        font-size: 30px;
        margin: .2em .2em .2em 0;
        padding: .1em .2em;
      }
      .t-button{
        margin: 0 37px 0 37px;
        width:203px;
        top: 10px;
      }
      button.t-button{
        margin: .2em 37px .2em 37px;
        width:220px;
      }
      .t-upload-files{
        margin: 0.2em 2.6em 1em;
      }
      #main{
        float:left;
      }
      h1, h2{
        margin:0;padding:0 0 0.3em;
        text-align:center;
        color:#ffd;
      }
      #phone,#anim{
        width:401px;
        height:875px;
        background-image:url(phone.png);
        position: absolute;
        top:10px;
        left:350px;
      }
      #anim{
        background-image:url("files/spec.png");
        background-position:0 0;
        background-repeat:no-repeat;
        height:480px;
        left:391px;
        top:144px;
        width:320px;
      }
      a img{
        border:none;
      }
    </style>
      <script type="text/javascript">
        $(function(){

          var i=0, x={timer:null, frames:4, frameWidth:320, frameRate:150};

          var addTestFile = function(filename){
            $('#test-files').append(
              $('<button />').addClass('t-button custom').html(filename).click(function(){
                $anim = $('#anim').css({backgroundImage:'url("files/'+filename+'")'})
                  var loop = function(){
                    $anim.css({backgroundPosition:"0 0"}).animate({borderWidth:0},150,function(){
                      $anim.css({backgroundPosition:"-320px 0"}).animate({borderWidth:0},150,function(){
                        $anim.css({backgroundPosition:"-640px 0"}).animate({borderWidth:0},150,function(){
                          $anim.css({backgroundPosition:"-960px 0"}).animate({backgroundPosition:"-640px 0"},250,function(){

                          })
                        })
                      })
                    })
                  }
                  clearInterval(x.timer)
                  x.timer = setInterval(function(){
                  loop()
                  }, 950)
              })
            )
          }

          $.get('files.php',function(d){
            $.each(d, function(i,file){
              addTestFile(file)
            })
          })

          $("#files").kendoUpload({
            async: {
              saveUrl: "./save.php",
              // removeUrl: "./remove.php",
              autoUpload: true
            },
            showFileList: true,
            success: function(e){

              $('.t-file').last().siblings().remove()

              var filename = e.files[0].name.replace(/\s/g,'-')

              $('#test-files button').filter(function(){
                return $(this).text() == filename
              }).remove()

              addTestFile(filename)

              console.log('uploaded' + e.files[0].name);
              //              return true;
            },
            error: function(e){
              console.log("Error (" + e.operation + ")");
              e.preventDefault(); // Suppress error message
            }

          });
        });
      </script>
  </head>
  <body>
    <div id="sidebar">
      <h2>Animation Tool</h2>

      <div id='one' class='step'>
        <span class='step-id'>1</span>
        <p class="first">Get the specification image</p>
        <p><a href="getspec.php" class='t-button'>Download image...</a></p>
      </div>

      <div id='two' class='step'>
        <span class='step-id'>2</span>
        <p class="first">Edit the downloaded image file</p>

      </div>

      <div id='three' class='step'>
        <span class='step-id'>3</span>
        <p class="first">Upload your edited file</p>
        <input name="files" id="files" type="file" />
      </div>

      <div id='two' class='step'>
        <span class='step-id'>4</span>
        <p class='first'>Test you animation</p>
        <span id='test-files'></span>
      </div>

    </div>
    <div id="main">
      <div id="anim"></div>
      <div id="phone"></div>
    </div>
  </body>
</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

-柠檬树下少年和吉他 2024-12-11 14:00:34

我的猜测是其中一个 css 文件没有被拉入。我在这里创建了一个小提琴,其中遗漏了 kendo.common.min.css 并且结果与你的不完全相同,但是太接近了。

http://jsfiddle.net/B4dW​​B/

检查您的 css 引用并确保它们全部正确并已加载。

My guess is one of the css files is not getting pulled in. I created a fiddle here where I left out the kendo.common.min.css and the result is not exactly the same as yours, but too darn close.

http://jsfiddle.net/B4dWB/

Check your css references and make sure they are all correct and loaded in.

爱你不解释 2024-12-11 14:00:34

验证所有内容是否正确加载的最简单方法是使用浏览器开发人员工具(Firefox 中的 Firebug、Chrome/Safari 中的开发人员工具)。

在网络选项卡上,您应该能够查看 Kendo UI CSS 和 JavaScript 文件是否已从远程服务器正确加载。 (这也是确保您没有看到页面/资源的缓存版本的好时机。这始终是一个简单的浏览器调试陷阱。)

一般来说,因为 Kendo UI 在浏览器中运行,您的托管环境和 Web 服务器应该不会受到影响。只要文件到达浏览器,渲染和行为就应该正常运行。

The easiest way to validate everything is loading correctly is to use your browser developer tools (Firebug in Firefox, Developer Tools in Chrome/Safari).

On the network tab, you should be able to see if the Kendo UI CSS and JavaScript files are being properly loaded from your remote server. (This is also a good time to make sure you're not seeing a cached version of your page/resources. That's always an easy browser debugging gotcha.)

In general, since Kendo UI runs in the browser, your hosting environment and web server should have no impact. As long as the files reach the browser, the rendering and behavior should function properly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文