Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/web-klick.de/dsh/50_dev2017/1303__autotestfrontend/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/web-klick.de/dsh/50_dev2017/1303__autotestfrontend/SettingsControl.js

/*

   Copyright:

   License:

   Authors:

 */

/* 

#asset(autotest/*)

 */

/**
 * This class defines the logic needed for the TestTree
 */
qx.Class.define("autotest.SettingsControl", {
   
   extend         : qx.application.Standalone,
   
   /**
    * The constructor handles the initializations for every testtree screen
    * 
    * @param settings_screen  - a qooxdoo container for the testtree etc
    * @param rpc_url             - a string containing the rpc url 
    * @param rpc_service         - a string containing the rpc service (method to call)
    */

   construct : function(parent) { // Call super class
      this.base(arguments);
      qx.Class.include(qx.ui.treevirtual.TreeVirtual,qx.ui.treevirtual.MNode);
      this.parent          = parent;
      this.settings_screen = parent.settings_screen;
      this.rpc             = new qx.io.remote.Rpc().set({url:parent.rpc_url,serviceName:parent.rpc_service});
      this.tabView         = parent.tabView;
      this.rpcMutex        = false;
      this.parents         = {};
   },
   
   
   members        : {
   
//  Label formats:

      f_big       : {font: qx.bom.Font.fromString("18px sans-serif")},
      f_normal    : {font: qx.bom.Font.fromString("13px sans-serif")},



/** 
 * initialization method for the project_tree screen
 *    clears the screen and sets layouts 
 * @param testtree_path
 * @param testproject_name
 */
   init : function (projects_path,user) {

   this.info("init(): called with params ",projects_path,user);
   this.user          = user;
   this.settings_screen.removeAll();
   
   //set up for layout and tree
   this.settings_screen.setLayout (new qx.ui.layout.VBox(20));
   this.splitpane = new qx.ui.splitpane.Pane("horizontal").set({width:400,decorator:"main"});
   this.settings_screen.add(this.splitpane);
   
   this.detailView = new qx.ui.container.Composite(new qx.ui.layout.VBox(15)).set({minWidth:400, padding:20});
   this.setDetailView();
   this.project_tree = new qx.ui.treevirtual.TreeVirtual(["Test Projects","Type"]).set({minWidth: 500, rowHeight: 20, openCloseClickSelectsRow:true});
   this.project_tree.getTableColumnModel().getBehavior().setMinWidth(0, 200);
   this.dataModel = this.project_tree.getDataModel();
   this.splitpane.add(this.project_tree,0);
   this.splitpane.add(this.detailView,1);

   //listeners for the tree
   this.project_tree.addListener("treeOpenWithContent",this.expand_children,  this);
   this.project_tree.addListener("changeSelection",          this.selectionChanged,     this);
   this.project_tree.addListener("dblclick",this.openProjAndSwitch,  this);
   
   //add first element
   this.node          = null;
   this.projects_path = "";
   this.expand_children_1(["-"+projects_path]);
},


/**
 * called when a node is opened
 */
expand_children : function (event) {
   this.node           = event.getData().nodeId;
   this.projects_path  = event.getData().columnData[10];
   this.rpc_call([qx.lang.Function.bind(this.expand_children_1,this),"manage_testtrees",this.projects_path,this.user,""]);
},

/**
 * adds node elements from rpc result
 */
expand_children_1 : function(result, exc) {
   this.info("expand_children_1(): called with params: ",result);
   if (exc != null) { 
      this.error("expand_children_1(): RPC-Call failed " + exc); 
      return;
   }
   if (this.node != null) { this.dataModel.prune(this.node,false);}
   //add "loading..." element when no results are given
   if (result.length == 0) {
      this.project_tree.nodeSetOpened(this.node,false);
      this.dataModel.addBranch(this.node,"loading...");
   } else {
      while (result.length > 0) {
         var elem_type  = result[0].substr(0,1);
         var name    = result.shift().substr(1);
         var node_id="";
         if (elem_type == "-") { 
            node_id = this.dataModel.addBranch(this.node,name);
            this.dataModel.setColumnData(node_id,1,"DIR");  }
         if (elem_type == "+") { 
            node_id = this.dataModel.addBranch(this.node,name,false,false,"autotest/project.png","autotest/project.png");
            this.dataModel.setColumnData(node_id,1,"..PROJ");  }
         if (elem_type == '*') { 
            node_id = this.dataModel.addBranch(this.node,name);
            this.dataModel.setColumnData(node_id,1,"..TEST");  }
         if (elem_type == ":") { 
            node_id = this.dataModel.addLeaf(this.node,name,"autotest/user_admin.png","autotest/user_admin.png");
            this.dataModel.setColumnData(node_id,1,"....ADMIN"); }
         if (elem_type == ".") { 
            node_id = this.dataModel.addLeaf(this.node,name,"autotest/user_user.png","autotest/user_admin.png");
            this.dataModel.setColumnData(node_id,1,"....USER");  
         }
         if (elem_type != "." && elem_type != ":") {this.dataModel.addBranch(node_id,"loading...");}
         
         this.dataModel.setColumnData(node_id,10,this.projects_path+"/"+name);   
         this.dataModel.setColumnData(node_id,11,elem_type);
         this.parents[node_id]=this.node;
      }
   }
   this.dataModel.setData();
   this.tabView.setEnabled(true);
   this.rpcMutex=false;
},


/**
 * is called when a row in the project tree is selected
 *  sets the detailview of the current item with different options depending on the type
 */
selectionChanged : function (e) {
   this.selectedNode = this.project_tree.getSelectedNodes().shift().nodeId;
   var elem_type = this.dataModel.getColumnData(this.selectedNode,11);
   var name = this.project_tree.nodeGetLabel(this.selectedNode);
   
   this.detailView.nameLabel.setValue("<b>Selected:</b> "+name);
   this.detailView.insertButton.setVisibility("visible");
   this.detailView.renameButton.setVisibility("visible");
   this.detailView.deleteButton.setVisibility("visible");
   this.detailView.optionsLabel.setVisibility("visible");
   this.detailView.openProjButton.setVisibility("hidden");
   if (elem_type == "-") {
      this.detailView.typeLabel.setValue("<b>Type:</b> Directory");
      this.detailView.insertButton.set({label:"Insert project or directory"});
   }else if (elem_type == "+") { 
      this.detailView.typeLabel.setValue("<b>Type:</b> Project");
      this.detailView.insertButton.set({label:"Insert User"});
      this.detailView.openProjButton.setVisibility("visible");
   }else if (elem_type == '*') { 
      this.detailView.typeLabel.setValue("<b>Type:</b> Test");
   }else if (elem_type == "." || elem_type == ":") { 
      this.detailView.typeLabel.setValue("<b>Type:</b> User");
      this.detailView.insertButton.setVisibility("hidden");
      this.detailView.renameButton.setVisibility("hidden");
   }
},

/**
 * setup of detail view on the left
 */
setDetailView : function (){
   this.detailView.removeAll();
   this.detailView.nameLabel = new qx.ui.basic.Label("<b>Selected: none </b> ").set({rich:true});
   this.detailView.typeLabel = new qx.ui.basic.Label("<b>Type: none </b> ").set({rich:true});
   this.detailView.optionsLabel = new qx.ui.basic.Label("<b>Options:</b>").set({rich:true, visibility:"hidden"});
   var statusContainer = new qx.ui.container.Composite(new qx.ui.layout.HBox(15));
   statusContainer.add(this.detailView.nameLabel);statusContainer.add(this.detailView.typeLabel);
   
   this.detailView.insertButton = new qx.ui.form.Button("Insert").set({visibility:"hidden"});
   this.detailView.renameButton = new qx.ui.form.Button("Rename").set({visibility:"hidden"});
   this.detailView.deleteButton = new qx.ui.form.Button("Delete").set({visibility:"hidden"});
   //the button listeners call buttonHandler with an id to identify the button pressed
   this.detailView.insertButton.addListener("execute",function(){this.buttonHandler(0);},this);
   this.detailView.renameButton.addListener("execute",function(){this.buttonHandler(1);},this);
   this.detailView.deleteButton.addListener("execute",function(){this.buttonHandler(2);},this);
   
   var buttonContainer = new qx.ui.container.Composite(new qx.ui.layout.HBox(10)).set({padding:30});
   buttonContainer.add(this.detailView.insertButton);
   buttonContainer.add(this.detailView.renameButton);buttonContainer.add(this.detailView.deleteButton);
   
   this.detailView.openProjButton = new qx.ui.form.Button("Open Project").set({visibility:"hidden"});
   this.detailView.openProjButton.addListener("execute", this.openProjAndSwitch, this);
   
   this.detailView.add(statusContainer);this.detailView.add(this.detailView.optionsLabel);
   this.detailView.add(buttonContainer);
   this.detailView.add(this.detailView.openProjButton);
   this.detailView.errorLabel = new qx.ui.basic.Label("");
   this.detailView.add(this.detailView.errorLabel);
},

/**
 * handles the button listeners from the detail view
 * @param btnId - the button id for identification
 */
buttonHandler : function(btnId){
   var elem_type = this.dataModel.getColumnData(this.selectedNode,11);
   switch (btnId) {
   case 0://insert
      if (elem_type=="-") this.insert_new_test_project();
      if (elem_type=="+") this.insert_new_user();
      break;
   case 1://rename
      if (elem_type=="-" || elem_type=="+") this.rename_test_project();
      break;
   case 2://delete
      if (elem_type=="+" || elem_type=="-") this.delete_test_project(this.project_tree.nodeGetLabel(this.selectedNode));
      if (elem_type==".") alert("to be implemented: delte user, roll: user");
      if (elem_type==":") alert("to be implemented: delte user, roll: admin");
      break;
 }
},

/**
 * opens the project and switches to test tree view
 */
openProjAndSwitch : function(){
   var elem_type = this.dataModel.getColumnData(this.selectedNode,11);
   if (elem_type=="+"){
      this.projects_path = this.dataModel.getColumnData(this.selectedNode,10);
      this.parent.loginInfo.projLabel.setValue("Active project: " + this.project_tree.nodeGetLabel(this.selectedNode));
      this.parent.testtree_control.init(this.projects_path,"");
      this.parent.requirement_control.init(this.projects_path,"");
      this.parent.tabView.setSelection([this.parent.testtree_screen]);
   }
},

/**
 * 
 */
insert_new_test_project : function () {   
   var name  = new qx.ui.form.TextField().set({required:true});
   var ins_form = new qx.ui.form.Form();

   ins_form.addGroupHeader("Insert");
   ins_form.add(name,"Name");

   var ins_window = new qx.ui.window.Window("Insert").set({ width: 450, height: 200, showClose : false, showMinimize : false });
   ins_window.setLayout(new qx.ui.layout.Basic());

   var button  = new qx.ui.form.Button("Create Test Project");
   var button1 = new qx.ui.form.Button("Create Sub-Directory");
   var cancel  = new qx.ui.form.Button("Cancel");

   button.addListener("execute", function(e) {
      ins_window.close();
      this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",this.projects_path,this.user,"+"+name.getValue()]);
      this.updateNode(this.selectedNode);
   }, this);

   button1.addListener("execute", function(e) {
      ins_window.close();
      this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",this.projects_path,this.user,"-"+name.getValue()]);
      this.updateNode(this.selectedNode);
   }, this);

   cancel.addListener("execute", function(e) {
      ins_window.close();
      this.tabView.setEnabled(true);
   }, this);
 
   ins_form.addButton(button);
   ins_form.addButton(button1);
   ins_form.addButton(cancel);

   ins_window.add(new qx.ui.form.renderer.Single(ins_form), {left: 10, top: 20});
   ins_window.open();
   ins_window.moveTo(400,70);
   this.tabView.setEnabled(false);
},


/**
 * 
 */
rename_test_project : function () {
   var name                      = new qx.ui.form.TextField().set({required:true});
   this.rename_test_project_form = new qx.ui.form.Form();

   this.rename_test_project_form.addGroupHeader("Rename Test Project");
   this.rename_test_project_form.add(name,"Name");

   var ren_window = new qx.ui.window.Window("Rename Directory").set(
         { width: 250, height: 200, showClose : false, showMinimize : false });
   ren_window.setLayout(new qx.ui.layout.Basic());

   var button = new qx.ui.form.Button("Rename");
   var cancel = new qx.ui.form.Button("Cancel");

   button.addListener("execute", function(e) {
      ren_window.close();
      this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",this.projects_path,this.user,";"+name.getValue()]);
      this.updateNode(this.parents[this.selectedNode]);
   }, this);

   cancel.addListener("execute", function(e) {
      ren_window.close();
      this.tabView.setEnabled(true);
   }, this);
   
   this.rename_test_project_form.addButton(button);
   this.rename_test_project_form.addButton(cancel);

   ren_window.add(new qx.ui.form.renderer.Single(this.rename_test_project_form), {left: 10, top: 20});
   ren_window.open();
   ren_window.moveTo(400,70);
   this.tabView.setEnabled(false);

},

/**
 * 
 * @param name
 */
delete_test_project : function (name) {
   var del_form = new qx.ui.form.Form();
   del_form.addGroupHeader("Do you really wish to delete ''" + name + "''");

   var del_window = new qx.ui.window.Window("Delete Directory / Project").set({width: 500, height: 200, showMinimize : false });
   del_window.setLayout(new qx.ui.layout.VBox(10));

   var del_btn = new qx.ui.form.Button("Delete");
   var cancel_btn = new qx.ui.form.Button("Cancel");

   del_btn.addListener("execute", function(e) {
      del_window.close();
// this.info("SQE: " + this.projects_path);
//      if (!(/^(.*)[\/\\](.*)$/.test(this.projects_path))) return;
//      this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",RegExp.$1,this.user,"="+RegExp.$2]);
      this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",this.projects_path,
                                                                      this.user,"="+name]);
      this.updateNode(this.parents[this.selectedNode]);
   }, this);

   cancel_btn.addListener("execute", function(e) {
      del_window.close();
      this.tabView.setEnabled(true);
   }, this);
 
   del_form.addButton(del_btn); del_form.addButton(cancel_btn);



   del_window.add(new qx.ui.form.renderer.Single(del_form));
   del_window.open();
   del_window.moveTo(400,70);
   this.tabView.setEnabled(false);
},

/**
 * 
 */
insert_new_user : function () {
   var name                  = new qx.ui.form.TextField().set({required:true});
   var ins_form = new qx.ui.form.Form();

   ins_form.addGroupHeader("New User");
   ins_form.add(name,"Name");

   var ins_window = new qx.ui.window.Window("New User").set(
         { width: 250, height: 200, showClose : false, showMinimize : false });
   ins_window.setLayout(new qx.ui.layout.Basic());

   var button  = new qx.ui.form.Button("Create User");
   var cancel  = new qx.ui.form.Button("Cancel");

   button.addListener("execute", function(e) {
      ins_window.close();
      this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",this.projects_path,this.user,":"+name.getValue()]);
      this.updateNode(this.selectedNode);
   }, this);

   cancel.addListener("execute", function(e) {
      ins_window.close();
      this.tabView.setEnabled(true);
   }, this);
   
   ins_form.addButton(button);
   ins_form.addButton(cancel);

   ins_window.add(new qx.ui.form.renderer.Single(ins_form), {left: 10, top: 20});
   ins_window.open();
   ins_window.moveTo(400,70);
   this.tabView.setEnabled(false);
},

change_user : function (elem_type,auth_level) {
   if (elem_type == auth_level) { return; }
   if (!(/^(.*)[\/\\](.*)$/.test(this.projects_path))) {
      return;
   }
   this.projects_path = RegExp.$1;      //  betroffenes Testprojekt
   var name           = RegExp.$2;      //  zu aendernder User
   this.mode          = auth_level;
   
   if (this.user == name) { return; }  //  man darf sich nicht selbst als User aendern
   this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",this.projects_path,this.user,auth_level+name]);
},

/**
 * updates the children of a given nodeId
 * @param nodeId the nodeId referencing the node to be updated
 */
updateNode : function(nodeId){
   this.node           = nodeId;
   this.projects_path  = this.dataModel.getColumnData(this.node,10);
   this.rpc_call([qx.lang.Function.bind(this.expand_children_1,this),"manage_testtrees",this.projects_path,this.user,""]); 
},

/**
 * handles all rpc calls
 * @param params - contains all necessary parameters for the rpc call:
 * <li> the return function for the rpc result
 * <li> the name of the function to call 
 * <li> a maximum of 3 parameters for the target function
 */
rpc_call : function(params){
   if (this.rpcMutex==true){
      setTimeout(qx.lang.Function.bind(function(){this.rpc_call(params);},this), 100);
      return;
   }
   if (params.length!=5)this.error("rpc_call(): rpc params has a length != 5!");
   try {
      this.info("rpc_call(): sending rpc call with params:", params);
      this.rpcMutex=true;
      this.tabView.setEnabled(false);
      this.rpc.callAsync(params[0],params[1],params[2],params[3],params[4]);
   } catch(exc) {
      this.error("Exception during RPC call in delete_test_project: ", exc);
      this.tabView.setEnabled(true);
      this.rpcMutex=false;
   }
},

/**
 * handles all rpc returns where no special action is needed
 * @param result
 * @param exc
 */
rpc_return : function(result, exc) {
   this.info("rcp_return: got result: ",result);
   this.tabView.setEnabled(true);
   this.rpcMutex=false;
},

endofclass : null  } });


bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net