/hudson-core/src/main/resources/lib/form/validateButton.jelly

http://github.com/hudson/hudson · Unknown · 65 lines · 58 code · 7 blank · 0 comment · 0 complexity · ff0586b8f82abd6324ef5bd5ec7a0c05 MD5 · raw file

  1. <!--
  2. The MIT License
  3. Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
  4. Permission is hereby granted, free of charge, to any person obtaining a copy
  5. of this software and associated documentation files (the "Software"), to deal
  6. in the Software without restriction, including without limitation the rights
  7. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. copies of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in
  11. all copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. THE SOFTWARE.
  19. -->
  20. <!--
  21. -->
  22. <?jelly escape-by-default='true'?>
  23. <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
  24. <st:documentation>
  25. See
  26. http://wiki.hudson-ci.org/display/HUDSON/Jelly+form+controls
  27. for the reference.
  28. <st:attribute name="method" use="required">
  29. Server-side method that handles the validation. For example, if this is 'foo', you need "doFoo" on
  30. your descriptor class.
  31. </st:attribute>
  32. <st:attribute name="title" use="required">
  33. Caption of the validate button. Should be internationalized.
  34. </st:attribute>
  35. <st:attribute name="progress">
  36. Caption of the text shown while the AJAX call is in progress. For example, "checking..."
  37. </st:attribute>
  38. <st:attribute name="with">
  39. ','-separated list of fields that are sent to the server.
  40. </st:attribute>
  41. <st:attribute name="checkUrl">
  42. User-defined url for AJAX request. Default value is ${rootURL}/descriptor/${descriptor.clazz.name}
  43. </st:attribute>
  44. <st:attribute name="queryParams">
  45. Additional query params for AJAX request
  46. </st:attribute>
  47. </st:documentation>
  48. <f:nested>
  49. <div style="float:right">
  50. <input type="button" value="${title}" class="yui-button"
  51. onclick="validateButton('${checkUrl!=null? checkUrl : rootURL+'/descriptor/'+descriptor.clazz.name}/${method}${queryParams!=null? '?'+queryParams : ''}','${with}',this)" />
  52. </div>
  53. <div style="display:none;">
  54. <img src="${imagesURL}/spinner.gif" /> ${attrs.progress}
  55. </div>
  56. <div><!-- this is where the error message goes --></div>
  57. </f:nested>
  58. </j:jelly>