Changeset 6309


Ignore:
Timestamp:
Aug 21, 2013, 1:42:30 PM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #1729 and #1730. Fixed on exception handling pages.

Location:
trunk/www
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/exception/duplicate_wizard.jsp

    r6136 r6309  
    4848%>
    4949<base:page type="popup" menu="exception" title="Another plug-in wizard is active">
    50 <base:head scripts="exception.js">
    51   <script>
    52   function goNext()
    53   {
    54     if (confirm('Are you sure? Unsaved settings in the other wizard will be lost.'))
    55     {
    56       location.replace(location.href + '&warnIfOpen=0');
    57     }
    58   }
    59   </script>
    60 </base:head>
    61 <base:body onload="Exception.fixWindow(false)">
     50<base:head scripts="exception.js" />
     51<base:body>
    6252
    6353  <h1>Another plug-in configuration wizard is open</h1>
     
    7262
    7363  <base:buttongroup subclass="dialogbuttons">
    74     <base:button onclick="goNext();" title="Continue" image="gonext.png" />
    75     <base:button onclick="window.top.close();" title="Cancel" />
     64    <base:button id="continuePluginWizard" title="Continue" image="gonext.png" />
     65    <base:button id="close" title="Cancel" />
    7666  </base:buttongroup>
    7767 
  • trunk/www/exception/exception.jsp

    r6139 r6309  
    111111<base:page type="default" menu="exception" title="Unexpected error">
    112112<base:head scripts="exception.js" styles="popup.css" />
    113 <base:body onload="Exception.fixWindow(true)">
     113<base:body data-resize-if-popup="1">
    114114  <h1><%=exceptionClassName + " on page "+request.getAttribute("javax.servlet.error.request_uri")%></h1>
     115 
    115116  <div class="content bottomborder" style="bottom: 3em;">
    116117    <table class="fullform outlined topborder">
     
    197198        }
    198199        %>
    199         <span id="more_detail">
    200           <base:icon image="gonext.png" />
    201           <a href="javascript:Main.show('error_detail');Main.hide('more_detail');"><%=st.length-i%> more...</a>
    202         </span>
    203      
     200        <base:icon
     201          id="showMoreDetails"
     202          data-show-id="error_detail"
     203          image="gonext.png"><%=st.length-i%> more...</base:icon>
    204204      </td>
    205205    </table>
     
    207207 
    208208  <base:buttongroup subclass="dialogbuttons">
    209     <base:button id="goback" onclick="<%="history.go(-1)"%>" title="Back"/>
    210     <base:button id="close" onclick="<%="window.top.close()"%>" title="Close"/>
    211     <base:button id="reportbug" onclick="<%="window.open('"+reportbuglink+"','Reportbug')"%>"
    212       title="Report bug&hellip;" image="bug.png"
    213     visible="<%=HTML.isValidUrl(reportbuglink)%>"/>
     209    <base:button id="goback" title="Back"/>
     210    <base:button id="close" title="Close"/>
     211    <base:button id="reportbug" title="Report bug&hellip;" image="bug.png"
     212      data-report-link="<%=HTML.encodeTags(reportbuglink) %>"
     213      visible="<%=HTML.isValidUrl(reportbuglink)%>"/>
    214214  </base:buttongroup>
    215215
  • trunk/www/exception/invalid_data.jsp

    r5956 r6309  
    6060<base:page type="default" menu="exception" title="Invalid data">
    6161<base:head scripts="exception.js" styles="popup.css"/>
    62 <base:body onload="Exception.fixWindow(false)">
     62<base:body>
    6363  <h1><%=exceptionClassName + " on page "+request.getAttribute("javax.servlet.error.request_uri")%></h1>
    6464
     
    7070
    7171  <base:buttongroup subclass="dialogbuttons">
    72     <base:button onclick="history.go(-1);" title="Back" />
    73     <base:button onclick="window.top.close();" title="Close" />
     72    <base:button id="goback" title="Back" />
     73    <base:button id="close" title="Close" />
    7474  </base:buttongroup>
    7575
  • trunk/www/exception/not_logged_in.jsp

    r6167 r6309  
    5151final String redirect = Values.getString((String)request.getAttribute("redirect"));
    5252%>
    53 <base:page type="default" menu="exception" title="">
     53<base:page type="default" menu="exception" title="Not logged in">
    5454<base:head scripts="exception.js,/login.js" styles="login.css" />
    55 <base:body>
     55<base:body data-resize-if-popup="1">
    5656
    5757    <form action="<%=root%>login.jsp?again=1" method="post" name="login" target="Login">
  • trunk/www/exception/permission_denied.jsp

    r5956 r6309  
    6161<base:page type="default" menu="exception" title="Permission denied">
    6262<base:head scripts="exception.js" styles="popup.css"/>
    63 <base:body onload="Exception.fixWindow(false)">
     63<base:body>
    6464  <h1><%=exceptionClassName + " on page "+request.getAttribute("javax.servlet.error.request_uri")%></h1>
    6565
     
    7171
    7272  <base:buttongroup subclass="dialogbuttons">
    73     <base:button onclick="history.go(-1);" title="Back" />
    74     <base:button onclick="window.top.close();" title="Close" />
     73    <base:button id="goback" title="Back" />
     74    <base:button id="close" title="Close" />
    7575  </base:buttongroup>
    7676
  • trunk/www/exception/web.jsp

    r6021 r6309  
    5252<base:page type="<%=ex.getPageType()%>" menu="auto" title="<%=ex.getTitle()%>">
    5353<base:head scripts="exception.js" />
    54 <base:body onload="Exception.fixWindow(false)">
     54<base:body>
    5555
    5656  <h1><%=ex.getTitle()%></h1>
     
    6464    </td></tr>
    6565    </table>
    66    
    6766  </div>
    6867 
    6968  <base:buttongroup subclass="dialogbuttons">
    70     <base:button id="goback" onclick="history.go(-1);" title="Back" />
    71     <base:button id="close" onclick="window.top.close();" title="Close" />
     69    <base:button id="goback" title="Back" />
     70    <base:button id="close" title="Close" />
    7271  </base:buttongroup>
    7372 
  • trunk/www/filemanager/upload/index.jsp

    r6308 r6309  
    153153  %>
    154154  <base:page type="popup" title="<%=title%>" id="select-file">
    155   <base:head scripts="~upload.js" styles="progressbar.css">
    156     <script>
    157     // Callback that shows the upload-frame in case of an error
    158     function exceptionHandlerCallback(windowName)
    159     {
    160       if (windowName == 'upload')
    161       {
    162         Main.show('uploadForm');
    163         Main.hide('progressForm');
    164       }
    165     }
    166     </script>
    167   </base:head>
    168   <base:body>
     155  <base:head scripts="~upload.js" styles="progressbar.css" />
     156  <base:body data-notify-on-error="1">
    169157  <div id="selectForm" class="absolutefull">
    170158    <h1><%=title%> <base:help helpid="file.upload"/></h1>
  • trunk/www/filemanager/upload/upload.js

    r6308 r6309  
    4646      // File
    4747      Events.addEventHandler('the_file', 'change', upload.fileOnChange);
     48     
     49      // Error handling
     50      Events.addEventHandler(document.body, 'base-notify', upload.onUploadError);
    4851    }
    4952    else if (pageId == 'upload-results')
     
    258261    }
    259262  }
     263 
     264  upload.onUploadError = function(event)
     265  {
     266    if (event.detail.errorWindow == 'upload')
     267    {
     268      Main.show('uploadForm');
     269      Main.hide('progressForm');
     270    }
     271  }
    260272
    261273  return upload;
  • trunk/www/include/scripts/exception.js

    r5940 r6309  
    2525  @version 2.16
    2626*/
    27 var Exception = new ExceptionClass();
     27var Exception = function()
     28{
     29  var exception = {};
     30 
     31  exception.initPage = function()
     32  {
     33    var resizeIfPopup = Data.int(document.body, 'resize-if-popup', 0);
    2834
    29 function ExceptionClass()
    30 {
    31   /*
    32     Fix the error window by hiding some elements that shouldn't be visisible at
    33     all times, resize the window, re-display the error message, etc...
     35    exception.fixWindow(resizeIfPopup);
     36   
     37    Buttons.addClickHandler('close', App.closeWindow);
     38    Buttons.addClickHandler('goback', exception.goBack);
     39    Buttons.addClickHandler('reportbug', exception.reportBug);
     40    Buttons.addClickHandler('showMoreDetails', exception.showMoreDetails);
     41    Buttons.addClickHandler('continuePluginWizard', exception.continuePluginWizard);
     42  }
    3443 
    35     @param resizeIfPopup If set, and the window is a popup window, it is resized to
    36       at least 800x600
    37   */
    38   ExceptionClass.prototype.fixWindow = function(resizeIfPopup)
     44  exception.fixWindow = function(resizeIfPopup)
    3945  {
    4046    var topWindow = window.top;
    4147    var isPopup = topWindow.opener != null;
    42    
    43     if (history.length <= 1) // >
     48    if (history.length <= 1)
    4449    {
    4550      Main.hide('goback');
     
    5257      if (resizeIfPopup)
    5358      {
    54         var width = Main.getWindowWidth(topWindow);
    55         var height = Main.getWindowHeight(topWindow);
    56         if (height < 600) height = 600;
    57         if (width < 800) width = 800;
    58         topWindow.resizeTo(width, height);
     59        var pos = App.getWindowPosition(topWindow);
     60        if (pos.height < 600 || pos.width < 800)
     61        {
     62          topWindow.resizeTo(Math.max(800, pos.width), Math.max(600, pos.height));
     63        }
    5964      }
    6065    }
     
    6974      }
    7075    }
    71     if (topWindow.exceptionHandlerCallback)
     76   
     77    var notify = Data.get(topWindow.document.body, 'notify-on-error');
     78    if (notify)
    7279    {
    73       topWindow.exceptionHandlerCallback(window.name);
     80      Events.sendCustomEvent(topWindow.document.body, 'base-notify', {'errorWindow': window.name});
     81    }
     82    /*
     83    alert(notify);
     84    if (topWindow != window)
     85    {
     86      alert(topWindow.exceptionHandlerCallback);
     87      if (topWindow.exceptionHandlerCallback)
     88      {
     89        topWindow.exceptionHandlerCallback(window.name);
     90      }
     91    }
     92    */
     93  }
     94 
     95  exception.goBack = function()
     96  {
     97    history.go(-1);
     98  }
     99 
     100  exception.reportBug = function(event)
     101  {
     102    var reportLink = Data.get(event.currentTarget, 'report-link');
     103    if (reportLink) window.open(reportLink, 'ReportBug');
     104  }
     105 
     106  exception.showMoreDetails = function(event)
     107  {
     108    var id = Data.get(event.currentTarget, 'show-id');
     109    Main.show(id);
     110    Main.hide(event.currentTarget.id);
     111  }
     112 
     113  exception.continuePluginWizard = function()
     114  {
     115    if (confirm('Are you sure? Unsaved settings in the other wizard will be lost.'))
     116    {
     117      location.replace(location.href + '&warnIfOpen=0');
    74118    }
    75119  }
    76120
    77 }
     121 
     122  return exception;
     123}();
    78124
     125Doc.onLoad(Exception.initPage);
     126
Note: See TracChangeset for help on using the changeset viewer.