⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 listgui.js

📁 Hippo CMS是一个以信息为中心的开源内容管理系统。Hippo CMS目标是供中,大型企业来管理其发布在互连网
💻 JS
字号:
/*
* Copyright 2001-2007 Hippo (www.hippo.nl)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function ListGUI() {
  if(!Cfx.Class.IsDefined(ListGUI)) {
    Cfx.Class.New(ListGUI);
  
    if(Cfx.Class.IsInitializing(ListGUI)) {
       ListGUI.Method(init);
       ListGUI.Method(update);
       ListGUI.Method(removeItem);
       ListGUI.Method(moveItemUp);
       ListGUI.Method(moveItemDown);
       
       return;
    }
  }
  this.InitInstance();

  this.div = null;
  this.list = null;
  
  return this;
  
  function init(list)
  {
    this.div = document.getElementById('listGUI');
    this.list = list;
  }

  function update1()
  {
    this.div.innerHTML = "";
    for (var i = 0; i < this.list.getNumberOfItems(); i++)
    {
      this.div.innerHTML += "<div>";
      this.div.innerHTML += this.list.getItem(i).getCaption();
      this.div.innerHTML += " <a href='javascript:var result = clipboard.getListView().removeItem("+i+")'>remove</a></div>";
    }
  }
  
  function update()
  {
    var html = '<table bgcolor="#eeeeee" cellspacing="1" cellpadding="1" width="97%" border="0">';
    
    // column headers
    html += '<tr>';
    html += '<td width="16" class="item_desc" height="14"><img height="1" width="16" src="/skin/images/empty.gif"/></td>';
    html += '<td nowrap="nowrap" class="item_desc" height="14" onclick="clipboard.getListView().sortOnCaption();">name</td>'; 
    html += '<td width="16" class="item_desc" height="14"><img height="1" width="16" src="/skin/images/empty.gif"/></td>';
    html += '<td width="16" class="item_desc" height="14"><img height="1" width="16" src="/skin/images/empty.gif"/></td>';
    html += '<td width="16" class="item_desc" height="14"><img height="1" width="16" src="/skin/images/empty.gif"/></td>';
    html += '</tr>';
    
    /*
  <td width="16" class="item_desc" height="14">
    <img height="1" width="16" src="/skin/images/empty.gif"/>
  </td>
</tr>    
    */
    
    // records
    for (var i = 0; i < this.list.getNumberOfItems(); i++)
    {
      if (i % 2 == 0)
      {
        html += '<tr class="item_a">';
      }
      else
      {
        html += '<tr class="item_b">';
      }
      html += '<td class="item_icon_cell">';
      html += '<img align="absmiddle" src="/skin/images/icons/16x16/document.gif"/>';
      html += '</td>';
      html += '<td><div>';
      html += this.list.getItem(i).getCaption();
      html += '</div></td>';
      html += '<td>';
      if (i < this.list.getNumberOfItems() - 1)
      {
        html += '<a href="javascript:var result = clipboard.getListView().moveItemDown(' + i + ')">';
        html += '<img src="/skin/images/icons/16x16/arrow_down_green.gif"/>';
        html += '</a>';
      }
      else
      {
        html += '&nbsp;';
      }
      html += '</td>';
      html += '<td>';
      if (i > 0)
      {
        html += '<a href="javascript:var result = clipboard.getListView().moveItemUp(' + i + ')">';
        html += '<img src="/skin/images/icons/16x16/arrow_up_green.gif"/>';
        html += '</a>';
      }
      else
      {
        html += '&nbsp;';
      }
      html += '</td>';
      html += '<td>';
      html += '<a href="javascript:var result = clipboard.getListView().removeItem(' + i + ')">';
      html += '<img src="/skin/images/icons/16x16/delete_simple_red.gif"/>';
      html += '</a>';
      html += '</td>';
      html += '</tr>';
    }
    html += '</table>';
    this.div.innerHTML = html;
  }
  
  function removeItem(item)
  {
    if (this.list.removeItem(item) != null)
    {
      this.update();
    }
  }
  
  function sortOnCaption()
  {
    this.list.sortOnCaption();
    this.update();
  }
  
  function moveItemUp(index)
  {
    this.list.moveItemUp(index);
    this.update();
  }

  function moveItemDown(index)
  {
    this.list.moveItemDown(index);
    this.update();
  }
  
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -