redmine中增加查询三步走

本文介绍如何使用Ruby on Rails创建月度任务量视图,包括数据映射、控制器和视图的设置过程。
假设有视图tasklists
(1)增加数据映射,在models中增加文件tasklist.rb:
class Tasklist < ActiveRecord::Base
end
(2)增加控制类及控制映射
A)controllers目录下增加tasklists_controller.rb:
class TasklistsController < ApplicationController
  # GET /monthworks
  # GET /monthworks.json
  def index
    
    @tasklists = Tasklist.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @tasklists }
    end
  end
 end
B)routes.rb中增加控制映射
  resources :tasklists

(3)增加视图类
在views中tasklists增加文件index.html.erb

<h1>月度任务量</h1>

<table class="list issues">
  <tr>
    <th class="checkbox hide-when-print">人员</th>
    <th class="checkbox hide-when-print">总任务</th>
    <th class="checkbox hide-when-print">完成任务</th>
   <th class="checkbox hide-when-print">延迟任务</th>
   <th class="checkbox hide-when-print">计划工时</th>
   <th class="checkbox hide-when-print">实际工时</th>
   <th class="checkbox hide-when-print">任务完成质量</th>
  </tr>

<% @tasklists.each do |tasklist| %>
  <tr  class="hascontextmenu odd issue status-1 priority-2 priority-default created-by-me">
    <td  class="project"><%= tasklist.lastname %><%= tasklist.firstname %></td>
    <td class="project"><%= tasklist.tasknum %></td>
    <td class="project"><%= tasklist.donetasknum %></td>
    <td class="project"><%= tasklist.latetasknum %></td>
    <td class="project"><%= tasklist.sworktime %></td>
    <td class="project"><%= tasklist.aworktime %></td>
    <td class="project"><%= tasklist.taskq %></td>
  </tr>
<% end %>
</table>

<br />

 
OK,搞定,访问http://220.178.25.130:8088/redmine/tasklists即可看到成果

static CMM_RET getIntfNameAndDns(LOAD_MULTI_CFG *pCfg,char interface[], size_t interfaceSize, char intfName[], size_t intfNameSize, char dns[], size_t dnsSize) { #if 0 DM_NUM_STACK dhcpstack = EMPTY_STACK_NUM; #endif DM_NUM_STACK ipIntfStack = EMPTY_STACK_NUM; DM_NUM_STACK pppstack = EMPTY_STACK_NUM; DM_NUM_STACK ipcpstack = EMPTY_STACK_NUM; DEV2_IP_INTF_OBJ ipIntfObj; #if 0 DEV2_DHCPV4_CLIENT_OBJ dhcpObj; #endif DEV2_PPP_INTF_IPCP_OBJ ipcpObj; DEV2_PPP_INTF_OBJ pppObj; DEV2_DNS_RELAY_FWD_OBJ dnsObj; CMM_RET ret = CMM_ERROR; char IPCP_PATH[64] = {0}; int isPppInterface = 0; const char *reqVersion = pCfg->ipVersion; // 测速IP版本(从配置提取) const char *dnsTypeStr = "DNS_A"; // DNS类型字符串(替代枚举,核心修 TR143_DEBUG ("dns start");//gzy #if defined(INCLUDE_QOE) && defined(INCLUDE_QOE_SPEEDTEST) FILE *fp = NULL; char dnsBuf[128] = {0}; #endif /*接口名称获取 路径到系统接口名*/ if ((ret = RDP_WRAP(CMM_UI_INTERNAL, OID_DEV2, rsl_util_getObjFromFullpath(interface, OID_DEV2_IP_INTF, sizeof(DEV2_IP_INTF_OBJ), &ipIntfStack, &ipIntfObj))) == CMM_OK) { CUTIL_STR_STRNCPY_NOCHECK(intfName, ipIntfObj.name, intfNameSize); } else if((ret = RDP_WRAP(CMM_UI_INTERNAL, OID_DEV2, rsl_util_getObjFromFullpath(interface, OID_DEV2_PPP_INTF, sizeof(DEV2_PPP_INTF_OBJ), &pppstack, &pppObj))) == CMM_OK) { CUTIL_STR_STRNCPY_NOCHECK(intfName, pppObj.name, intfNameSize); isPppInterface = 1; } else { TR143_PERROR(ret); return CMM_INVALID_ARGUMENTS; } if(isPppInterface) { sprintf(IPCP_PATH, "%s%s.", interface, "IPCP"); if ((ret = RDP_WRAP(CMM_UI_INTERNAL, OID_DEV2, rsl_util_getObjFromFullpath(IPCP_PATH, OID_DEV2_PPP_INTF_IPCP, sizeof(DEV2_PPP_INTF_IPCP_OBJ), &ipcpstack, &ipcpObj))) != CMM_OK) { TR143_PERROR(ret); return CMM_INVALID_ARGUMENTS; } if(dns != NULL) CUTIL_STR_STRNCPY_NOCHECK(dns, ipcpObj.DNSServers, dnsSize); #ifdef INCLUDE_ECONET_TR143_SPEEDUP //Bug 671009 - pppoe拨号下,样机无法使用tr098节点进行tr143测速 INIT_INSTANCE_ID_STACK(&ipIntfStack); while (CMM_OK == rdp_getNextObjStruct(CMM_UI_TR69, DEV2_IP_INTF, &ipIntfStack, sizeof(DEV2_IP_INTF_OBJ), &ipIntfObj)) { if(CUTIL_SAME_STR(ipIntfObj.name, pppObj.name)) { rdp_getFullpathFromStackWithoutLock(CMM_UI_NULL, OID_DEV2_IP_INTF, &ipIntfStack, interface, interfaceSize); TR143_DEBUG("after transfer, intf is %s", interface); break; } } #endif //INCLUDE_ECONET_TR143_SPEEDUP } else { /* Bugfix, do NOT get DNS Server from specific connection Object, User may use it's own DNS Server. get DNS from DEV2_DNS_RELAY_FWD instead. For more info refer to http://ispproject.rd.tp-link.net/redmine/issues/16513 */ #if 0 if (strcmp(ipIntfObj.X_TP_ConnType, "PPPoE") == 0) { if ((ret = RDP_WRAP(CMM_UI_INTERNAL, OID_DEV2, rsl_util_getObjFromFullpath(ipIntfObj.lowerLayers, OID_DEV2_PPP_INTF, sizeof(DEV2_PPP_INTF_OBJ), &pppstack, &pppObj))) != CMM_OK) { TR143_PERROR(ret); return CMM_INVALID_ARGUMENTS; } sprintf(IPCP_PATH, "%s%s.", ipIntfObj.lowerLayers, "IPCP"); if ((ret = RDP_WRAP(CMM_UI_INTERNAL, OID_DEV2, rsl_util_getObjFromFullpath(IPCP_PATH, OID_DEV2_PPP_INTF_IPCP, sizeof(DEV2_PPP_INTF_IPCP_OBJ), &ipcpstack, &ipcpObj))) != CMM_OK) { TR143_PERROR(ret); return CMM_INVALID_ARGUMENTS; } if(dns != NULL) CUTIL_STR_STRNCPY(dns, ipcpObj.DNSServers, DEV2_PPP_INTF_IPCP_DNSSERVERS_L); } else if (strcmp(ipIntfObj.X_TP_ConnType, "DHCP") == 0) { if ((ret = dm_getSpecifiedObj(CMM_UI_NULL, OID_DEV2_DHCPV4_CLIENT, "interface", interface, &dhcpstack, sizeof(DEV2_DHCPV4_CLIENT_OBJ), &dhcpObj)) != CMM_OK) { TR143_PERROR(ret); return CMM_INVALID_ARGUMENTS; }else{ if(dns != NULL) CUTIL_STR_STRNCPY(dns, dhcpObj.DNSServers, DEV2_DHCPV4_CLIENT_DNSSERVERS_L); } } else #endif /* #if 0 */ { if (rsl_dns_getWorkingDNS(interface, DMVS_DNS_A, NULL, &dnsObj) == TRUE) { if(dns != NULL) CUTIL_STR_STRNCPY_NOCHECK(dns, dnsObj.DNSServer, dnsSize); } #if defined(INCLUDE_QOE) && defined(INCLUDE_QOE_SPEEDTEST) /* avoid SAST error */ if (NULL == dns) { TR143_ERROR("dns is null"); } /* Get DNS Setting from /etc/resolv.conf (if dns is empty) */ else if (strcmp(dns, "") == 0) { fp = fopen("/etc/resolv.conf","r"); if(fp == NULL) { return CMM_ERROR; } if(fgets(dnsBuf,sizeof(dnsBuf),fp) != NULL) { sscanf(dnsBuf,"nameserver %s",dns); } fclose(fp); } #endif } } return CMM_OK; } 结合模块化分析这个函数 给出函数获取接口的逻辑和思路,然后如果我要添加IPV6的接口应该怎么做呢 给出需要修改的部分 和修改逻辑思路 以及需要修改部分的代码
最新发布
10-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值