cas.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Licensed to Jasig under one or more contributor license
  3. * agreements. See the NOTICE file distributed with this work
  4. * for additional information regarding copyright ownership.
  5. * Jasig licenses this file to you under the Apache License,
  6. * Version 2.0 (the "License"); you may not use this file
  7. * except in compliance with the License. You may obtain a
  8. * copy of the License at the following location:
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. var editInnerHTML = "";
  20. var deleteInnerHTML = "";
  21. var currentRow = null;
  22. function swapButtonsForConfirm(rowId, serviceId) {
  23. resetOldValue();
  24. var editCell = $("#edit"+rowId);
  25. var deleteCell = $("#delete"+rowId);
  26. var row = $("#row" + rowId);
  27. row.removeClass("over");
  28. row.addClass("highlightBottom");
  29. editInnerHTML = editCell.html();
  30. deleteInnerHTML = deleteCell.html();
  31. currentRow = rowId;
  32. editCell.html("Really?");
  33. deleteCell.html("<a id=\"yes\" href=\"deleteRegisteredService.html?id=" + serviceId + "\">Yes</a> <a id=\"no\" href=\"#\" onclick=\"resetOldValue();return false;\">No</a>");
  34. }
  35. function resetOldValue() {
  36. if (currentRow != null) {
  37. var curRow = $("#row"+currentRow);
  38. curRow.removeClass("over");
  39. curRow.removeClass("highlightBottom");
  40. var editCell = $("#edit"+currentRow);
  41. var deleteCell = $("#delete"+currentRow);
  42. editCell.html(editInnerHTML);
  43. deleteCell.html(deleteInnerHTML);
  44. editInnerHTML = null;
  45. deleteInnerHTML = null;
  46. currentRow = null;
  47. }
  48. }
  49. $(document).ready(function(){
  50. //focus username field
  51. $("input:visible:enabled:first").focus();
  52. //flash error box
  53. $('#msg.errors').animate({ backgroundColor: 'rgb(187,0,0)' }, 30).animate({ backgroundColor: 'rgb(255,238,221)' }, 500);
  54. //flash success box
  55. $('#msg.success').animate({ backgroundColor: 'rgb(51,204,0)' }, 30).animate({ backgroundColor: 'rgb(221,255,170)' }, 500);
  56. if (!window.console || window.console == {}) {
  57. window.console.log = function() {};
  58. }
  59. });