import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.hansky.intf.butterfly.*;
import com.hansky.intf.stateflow.*;
import com.hansky.apps.stateflow.uiext.*;
import com.hansky.intf.sat.*;
public void paintPanel(PrintWriter out, String placeHolder, IButterflyContext ctx, IStateflowObject sfo, IUIContext uiCtx) {
//这个是画详细页面的代码
}
public List initTabs(IButterflyContext ctx, IStateflowObject sfo) {
List l = new ArrayList();
return l;
}
public List removeTabs(IButterflyContext ctx, IStateflowObject sfo) { //删除Tab页面
List l = new ArrayList();
boolean flag = false ;
flag = com.spdb.pmsf.PsmfAccounting.CanSeeAttachment(ctx, sfo);
String[] runTab1 = new String[] {"tab_at", "附件"};
if(!flag){
l.add(runTab1 );
}
return l;
}
public List renameTabs(IButterflyContext ctx, IStateflowObject sfo) { //重命名Tab页面
List l = new ArrayList();
return l;
}
public void paintTab(PrintWriter out, String placeHolder, IButterflyContext ctx, IStateflowObject sfo, IUIContext uiCtx) {
}
============================================下面是原厂的人写的贴下===============================================================
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import org.dom4j.*;
import org.dom4j.io.*;
import com.hansky.apps.stateflow.uiext.*;
import com.hansky.intf.butterfly.*;
import com.hansky.intf.stateflow.*;
import com.hansky.firefly.xml.MergeCompare;
import com.hansky.intf.sat.*;
import com.hansky.sln.ff.config;
public paintPanel(PrintWriter out, String placeHolder, IButterflyContext ctx, IStateflowObject sfo, IUIContext uiCtx) {
return;
}
public List renameTabs(IButterflyContext ctx, IStateflowObject sfo) {
List l = new ArrayList();
return l;
}
public List removeTabs(IButterflyContext ctx, IStateflowObject sfo) {
List l = new ArrayList();
l.add(new String[] {"tab_al"});
if(!sfo.getBooleanField("isExternalSign")){
l.add(new String[] {"tab_at"});
}
return l;
}
public List initTabs(IButterflyContext ctx, IStateflowObject sfo) {
String folderPath = System.getProperty("hs.butterfly.dir")
+ File.separator + "chtml" + File.separator + "plugins"
+ File.separator + "sanbu" + File.separator + "compare"
+ File.separator + sfo.getStringField("temp_hs_uuid")+File.separator ;
String compare = folderPath+"compare.txt";
File comparefile = new File(compare);
if(comparefile.exists()){
List l = new ArrayList(1);
String[] tab1 = new String[] { "label", "配置项及比较文件"};
l.add(tab1);
if(!sfo.getState().isActive()){
IButterflyGroup group = ctx.getGroup("name","Security Manage");
if(group.hasUser(ctx.getUser())){
l.add(new String[] {"result", "运行结果"});
}
if( sfo.getBooleanField("isfalse")&&ctx.getProject("oid",sfo.getProjectOID()).getRole("name", "配置库管理员").hasUser(ctx.getUser())){
l.add(new String[] {"download", "下载/打印"});
}
}
return l;
}else
{
return new ArrayList();
}
}
public void paintTab(PrintWriter out, String placeHolder, IButterflyContext ctx, IStateflowObject sfo, IUIContext uiCtx) {
if("result".equals(placeHolder)){
String operate_result = sfo.getStringField("operate_result");
if (operate_result != null) {
operate_result = operate_result.replaceAll("\r\n", "<br />");
operate_result = operate_result.replaceAll("\n", "<br />");
operate_result = operate_result.replaceFirst("<br />", "");
}
String run_result = sfo.getStringField("run_result");
if (run_result != null) {
run_result = run_result.replaceAll("\r\n", "<br />");
run_result = run_result.replaceAll("\n", "<br />");
}
Map resultMap = new HashMap();
resultMap.put("operate_result",operate_result);
resultMap.put("run_result",run_result);
uiCtx.paintForm(out, "amend/amend_2/show/result.ftl", resultMap);
}else if("download".equals(placeHolder)){
Map resultMap = new HashMap();
resultMap.put("uuid",sfo.getOID());
resultMap.put("type",sfo.getObjectDef().getName());
resultMap.put("confirmResult",sfo.getBooleanField("is_print_config"));
String urlFlagruku="/butterfly/plugins/sanbu/portal/html/printing.bsh?uuid="+sfo.getOID()+"&sfName="+sfo.getObjectDef().getName()+"&flag=html&amendruku=amendruku";
resultMap.put("url_checkin",urlFlagruku);
resultMap.put("url","/butterfly/plugins/sanbu/portal/html/printing.bsh?uuid="+sfo.getOID()+"&sfName="+sfo.getObjectDef().getName()+"&flag=html&confirm=true");
uiCtx.paintForm(out, "amend/amend_2/show/download.htm", resultMap);
}else{
Map maps = new HashMap();
String folderPath = System.getProperty("hs.butterfly.dir")
+ File.separator + "chtml" + File.separator + "plugins"
+ File.separator + "sanbu" + File.separator + "compare"
+ File.separator + sfo.getStringField("temp_hs_uuid")+File.separator ;
String v1 = folderPath+"label1.xml";
String v2 = folderPath+"label2.xml";
String compare = folderPath+"compare.txt";
File comparefile = new File(compare);
if(comparefile.exists()){
config config = new config();
Map ffmap = config.getConfigFileParameter(ctx,"firefly.cfg");
String ffserver = (String)ffmap.get("ff.server");
maps.put("server",ffserver);
maps.put("v2",folderPath+"label1.xml");//新标记
maps.put("v1",folderPath+"label2.xml");//旧标记
maps.put("compare",folderPath+"compare.txt");
// ===== LvCreator == 8081服务使用修正 == START =====
final ISession session = ctx.createSession();
final IBusObject label_old = sfo.getSingleReference("before_label", session);
final IBusObject label_new = sfo.getSingleReference("after_label", session);
final IBusObject label_exe_new = sfo.getSingleReference("after_label_exe", session);
if(label_old != null && label_new != null){
maps.put("label_old", label_old.getStringField("name"));
maps.put("label_new", label_new.getStringField("name"));
if (label_exe_new != null) {
maps.put("label_exe_new", label_exe_new.getStringField("name"));
}
maps.put("proj_name", label_old.getSingleReference("proj", session).getStringField("name"));
// System.out.println("===== LvCreator Initialize Infomation : P:" + maps.get("proj_name") + "\tO:" + maps.get("label_old") + "\tN:" + maps.get("label_new"));
}
// ===== LvCreator == 8081服务使用修正 == END =====
uiCtx.paintForm(out, "amend/amend/show/show.htm", maps);
}
}
// maps.put("server","localhost");
// maps.put("v1","d://release_1.0.xml");
// maps.put("v2","d://release_2.0.xml");
// maps.put("compare","d://compare.txt");
// uiCtx.paintForm(out, "amend/amend/show/show.htm", maps);
}
=======================================================================这个是另外一个 ========================================
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.hansky.intf.butterfly.*;
import com.hansky.intf.stateflow.*;
import com.hansky.apps.stateflow.uiext.*;
import com.hansky.intf.sat.*;
public void paintPanel(PrintWriter out, String placeHolder, IButterflyContext ctx, IStateflowObject sfo, IUIContext uiCtx) {
return;
}
public List initTabs(IButterflyContext ctx, IStateflowObject sfo) { //这个函数里面可以新增sfo的tab页面
List l = new ArrayList();
String[] runTab1 = new String[] {"check_in", "准出检查单"};//tab页面的中英名名称
l.add(runTab1);
return l;
}
public void paintTab(PrintWriter out, String placeHolder, IButterflyContext ctx, IStateflowObject sfo, IUIContext uiCtx) {
Map m = new HashMap();
if ("check_in".equals(placeHolder)) {
m.put("sfoUUID", sfo.getUUID());
m.put("project", sfo.getStringField("hs_project"));
// uiCtx.paintForm(out, "/" + sfo.getObjectDef().getName() + "/" + sfo.getStateflow().getName() + "/show/sf_show.ftl", m);
}
}