PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/src/admin/views/sort.php

http://emlog.googlecode.com/
PHP | 126 lines | 125 code | 1 blank | 0 comment | 36 complexity | 823af81c35745f38770a52593300cea0 MD5 | raw file
  1. <?php if(!defined('EMLOG_ROOT')) {exit('error!');} ?>
  2. <script>setTimeout(hideActived,2600);</script>
  3. <div class=containertitle><b>????</b>
  4. <?php if(isset($_GET['active_taxis'])):?><span class="actived">??????</span><?php endif;?>
  5. <?php if(isset($_GET['active_del'])):?><span class="actived">??????</span><?php endif;?>
  6. <?php if(isset($_GET['active_edit'])):?><span class="actived">??????</span><?php endif;?>
  7. <?php if(isset($_GET['active_add'])):?><span class="actived">??????</span><?php endif;?>
  8. <?php if(isset($_GET['error_a'])):?><span class="error">????????</span><?php endif;?>
  9. <?php if(isset($_GET['error_b'])):?><span class="error">????????</span><?php endif;?>
  10. <?php if(isset($_GET['error_c'])):?><span class="error">????????????????????</span><?php endif;?>
  11. <?php if(isset($_GET['error_d'])):?><span class="error">??????</span><?php endif;?>
  12. <?php if(isset($_GET['error_e'])):?><span class="error">?????????????</span><?php endif;?>
  13. <?php if(isset($_GET['error_f'])):?><span class="error">????????</span><?php endif;?>
  14. </div>
  15. <div class=line></div>
  16. <form method="post" action="sort.php?action=taxis">
  17. <table width="100%" id="adm_sort_list" class="item_list">
  18. <thead>
  19. <tr>
  20. <th width="55"><b>??</b></th>
  21. <th width="300"><b>??</b></th>
  22. <th width="300"><b>??</b></th>
  23. <th width="50" class="tdcenter"><b>??</b></th>
  24. <th width="100"></th>
  25. </tr>
  26. </thead>
  27. <tbody>
  28. <?php foreach($sorts as $key=>$value): ?>
  29. <tr>
  30. <td>
  31. <input type="hidden" value="<?php echo $value['sid'];?>" class="sort_id" />
  32. <input maxlength="4" class="num_input" name="sort[<?php echo $value['sid']; ?>]" value="<?php echo $value['taxis']; ?>" /></td>
  33. <td class="sortname"><?php echo $value['sortname']; ?></td>
  34. <td class="alias"><?php echo $value['alias']; ?></td>
  35. <td class="tdcenter"><a href="./admin_log.php?sid=<?php echo $value['sid']; ?>"><?php echo $value['lognum']; ?></a></td>
  36. <td><a href="javascript: em_confirm(<?php echo $value['sid']; ?>, 'sort');">??</a></td>
  37. </tr>
  38. <?php endforeach;?>
  39. </tbody>
  40. </table>
  41. <div class="list_footer"><input type="submit" value="????" class="submit" /></div>
  42. </form>
  43. <form action="sort.php?action=add" method="post">
  44. <div style="margin:30px 0px 10px 0px;"><a href="javascript:displayToggle('sort_new', 2);">?????+</a></div>
  45. <div id="sort_new">
  46. <li>??</li>
  47. <li><input maxlength="4" style="width:30px;" name="taxis" /></li>
  48. <li>??</li>
  49. <li><input maxlength="200" style="width:200px;" name="sortname" id="sortname" /></li>
  50. <li>??</li>
  51. <li><input maxlength="200" style="width:200px;" name="alias" id="alias" /> (??URL?????)</li>
  52. <li><input type="submit" id="addsort" value="?????" class="submit"/><span id="alias_msg_hook"></span></li>
  53. </div>
  54. </form>
  55. <script>
  56. $("#sort_new").css('display', $.cookie('em_sort_new') ? $.cookie('em_sort_new') : 'none');
  57. $("#alias").keyup(function(){checksortalias();});
  58. function issortalias(a){
  59. var reg1=/^[\w-]*$/;
  60. var reg2=/^[\d]+$/;
  61. if(!reg1.test(a)) {
  62. return 1;
  63. }else if(reg2.test(a)){
  64. return 2;
  65. }else if(a=='post' || a=='record' || a=='sort' || a=='tag' || a=='author' || a=='page'){
  66. return 3;
  67. } else {
  68. return 0;
  69. }
  70. }
  71. function checksortalias(){
  72. var a = $.trim($("#alias").val());
  73. if (1 == issortalias(a)){
  74. $("#addsort").attr("disabled", "disabled");
  75. $("#alias_msg_hook").html('<span id="input_error">??????????????????????</span>');
  76. }else if (2 == issortalias(a)){
  77. $("#addsort").attr("disabled", "disabled");
  78. $("#alias_msg_hook").html('<span id="input_error">???????????</span>');
  79. }else if (3 == issortalias(a)){
  80. $("#addsort").attr("disabled", "disabled");
  81. $("#alias_msg_hook").html('<span id="input_error">????????????</span>');
  82. }else {
  83. $("#alias_msg_hook").html('');
  84. $("#msg").html('');
  85. $("#addsort").attr("disabled", '');
  86. }
  87. }
  88. $(document).ready(function(){
  89. $("#adm_sort_list tbody tr:odd").addClass("tralt_b");
  90. $("#adm_sort_list tbody tr")
  91. .mouseover(function(){$(this).addClass("trover")})
  92. .mouseout(function(){$(this).removeClass("trover")});
  93. $(".sortname").click(function a(){
  94. if($(this).find(".sort_input").attr("type") == "text"){return false;}
  95. var name = $.trim($(this).html());
  96. var m = $.trim($(this).text());
  97. $(this).html("<input type=text value=\""+name+"\" class=sort_input>");
  98. $(this).find(".sort_input").focus();
  99. $(this).find(".sort_input").bind("blur", function(){
  100. var n = $.trim($(this).val());
  101. if(n != m && n != ""){
  102. window.location = "sort.php?action=update&sid="+$(this).parent().parent().find(".sort_id").val()+"&name="+encodeURIComponent(n);
  103. }else{
  104. $(this).parent().html(name);
  105. }
  106. });
  107. });
  108. $(".alias").click(function b(){
  109. if($(this).find(".alias_input").attr("type") == "text"){return false;}
  110. var name = $.trim($(this).html());
  111. var m = $.trim($(this).text());
  112. $(this).html("<input type=text value=\""+name+"\" class=alias_input>");
  113. $(this).find(".alias_input").focus();
  114. $(this).find(".alias_input").bind("blur", function(){
  115. var n = $.trim($(this).val());
  116. if(n != m){
  117. window.location = "sort.php?action=update&sid="+$(this).parent().parent().find(".sort_id").val()+"&alias="+encodeURIComponent(n);
  118. }else{
  119. $(this).parent().html(name);
  120. }
  121. });
  122. });
  123. $("#menu_sort").addClass('sidebarsubmenu1');
  124. });
  125. </script>