Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/web-klick.de/dsh/90_akt/DEV1303/AutoQX/

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/90_akt/DEV1303/AutoQX/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);
      qx.Class.include(qx.ui.table.Table, qx.ui.table.MTableContextMenu);
      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 (parent_path,user) {

   this.info("init(): called with params ",parent_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.project_tree = new qx.ui.treevirtual.TreeVirtual(["Test Projects","Type"]).set({
      width:Math.floor(qx.bom.Viewport.getWidth()*0.5), rowHeight: 20,
      additionalStatusBarText: "            |   Right click for more options",
      statusBarVisible: true, openCloseClickSelectsRow:true});
   this.project_tree.getTableColumnModel().getBehavior().setMinWidth(0, 200);
   for (var i in this.project_tree._getPaneScrollerArr()){
      this.project_tree._getPaneScrollerArr()[i].setLiveResize(true);
   }
   this.dataModel = this.project_tree.getDataModel();
   this.settings_screen.add(this.project_tree);
   //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.getArchsAndOpenProj,this);
   this.project_tree.setContextMenuHandler(0, qx.lang.Function.bind(this.setContextMenu),this);
   //add first element
   this.node        = null;
   this.parent_path = "";
   this.expand_children_1(["-"+parent_path]);

   this.arch_window = new qx.ui.window.Window().set(
         {width: 350, height: 350, showClose : false, showMinimize : false });
   this.arch_window.setLayout(new qx.ui.layout.Canvas());
   this.tabView.setEnabled(false);
   this.project_tree.setEnabled(true);
   
   var active_project = this.rpc.callSync("get_active_project");
   
	if (active_project) {
		//this.selectedNode = this.project_tree.getSelectedNodes().shift().nodeId;
		this.elem_name = this.rpc.callSync("get_active_project");
		this.node_path = this.rpc.callSync("get_active_node_path");
		var testTree = this.node_path + "/" + this.elem_name
		var elem_type = "+";
		//this.info("PATH: " + this.selectedNode + "  " + elem_type + "  " + this.node_path + "/" + this.elem_name, "");
		this.parent.loginInfo.projLabel.setValue("Active project: " + this.elem_name);
		this.parent.testtree_control.init(testTree, "");
		this.parent.requirement_control.init(testTree, "");
		this.parent.arch_control.init(this.arch_data, testTree);
		this.tabView.setEnabled(true);
		this.tabView.setSelection([this.parent.testtree_screen]);
		
		this.arch_window.close();
		this.project_tree.setEnabled(true);
	}

},

/**
 * Called after doubleclicking on an element in the project tree
 *  if the doubleclick targeted a project the project is openend
 */
getArchsAndOpenProj : function (e){
   this.selectedNodeId = this.project_tree.getSelectedNodes().shift().nodeId;
   var elem_type = this.dataModel.getColumnData(this.selectedNodeId,11);
   if (elem_type=="+"){
      this.rpc_call([qx.lang.Function.bind(this.openProjAndSwitch,this),"architectures",
               this.node_path+"/"+this.elem_name]);
   }
},

/**
 * Creates the architecture container with list and configures it
 * @param: achitectures: a list of architectures to show in the list
 */
openProjAndSwitch: function (result,exc){
   this.rpcMutex=false;
   if (exc) {
      this.info("setArchSelection: got rpc error: ",exc);
      this.project_tree.setEnabled(true);
      return;
   }
   this.elem_name   = this.project_tree.nodeGetLabel(this.selectedNodeId);
   this.node_path   = this.dataModel.getColumnData(this.selectedNodeId,10);
   var testTree = this.node_path+"/"+this.elem_name
   
 //initialize tabs
   this.parent.loginInfo.projLabel.setValue("Active project: " + this.elem_name);
   
   this.parent.loginInfo.archSelection.removeAll();
   for (var i in result){
      this.parent.loginInfo.archSelection.add(
         new qx.ui.form.ListItem(i));
   }   
   
   this.parent.testtree_control.init(testTree,"",this.user);
   this.parent.requirement_control.init(testTree,"");
   this.parent.arch_control.init(result,testTree);
   this.tabView.setEnabled(true);
   this.tabView.setSelection([this.parent.testtree_screen]);

   this.project_tree.setEnabled(true);
},

/**
 * Sets the context Menu for right clicks
 */
setContextMenu : function (col, row, table, dataModel, contextMenu){
   var elem_type     = this.dataModel.getColumnData(this.selectedNodeId,11);
   if (elem_type == "-") {
      var insertProjBtn = new qx.ui.menu.Button("Insert project/directory");
      insertProjBtn.addListener("execute",qx.lang.Function.bind(this.insert_new_test_project),this);
      contextMenu.add(insertProjBtn);
   }
   else if (elem_type == "+") { //element == testproject
      var insertUserBtn = new qx.ui.menu.Button("Insert user");
      insertUserBtn.addListener("execute",qx.lang.Function.bind(this.insert_new_user),this);
      contextMenu.add(insertUserBtn);
      var renameBtn = new qx.ui.menu.Button("Rename");
      renameBtn.addListener("execute",qx.lang.Function.bind(this.rename_test_project),this);
      contextMenu.add(renameBtn);
      var deleteBtn = new qx.ui.menu.Button("Delete");
      deleteBtn.addListener("execute",qx.lang.Function.bind(function(){this.delete_test_project(this.project_tree.nodeGetLabel(this.selectedNodeId));}),this);
      contextMenu.add(deleteBtn);
      var openProjBtn = new qx.ui.menu.Button("Open project");
      openProjBtn.addListener("execute",qx.lang.Function.bind(this.getArchsAndOpenProj),this);
      contextMenu.add(openProjBtn);
   }
   else if (elem_type == "." || elem_type == ":") { //element == user
      var deleteBtn = new qx.ui.menu.Button("Delete");
      deleteBtn.addListener("execute",qx.lang.Function.bind(function(){this.change_user(this.project_tree.nodeGetLabel(this.selectedNodeId),elem_type,0);}),this);
      var chPwdBtn = new qx.ui.menu.Button("Change Password");
      chPwdBtn.addListener("execute",qx.lang.Function.bind(function(){this.change_user(this.project_tree.nodeGetLabel(this.selectedNodeId),elem_type,1);}),this);
      contextMenu.add(deleteBtn);
      contextMenu.add(chPwdBtn);
   }
   return true;
},


/**
 * called when a node is opened
 */
expand_children : function (event) {

   this.node         = event.getData().nodeId;
   this.parent_path  = event.getData().columnData[10] + "/" + this.project_tree.nodeGetLabel(this.node);
   this.rpc_call([qx.lang.Function.bind(this.expand_children_1,this),"manage_testtrees",this.parent_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);
      this.project_tree.nodeSetOpened(this.node,false);
      this.project_tree.setEnabled(true);
      this.rpcMutex = false;
      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,"Directory");  }
         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,"Project");  }
         if (elem_type == '*') {
            node_id = this.dataModel.addBranch(this.node,name);
            this.dataModel.setColumnData(node_id,1,"Testitem");  }
         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.parent_path);
         this.dataModel.setColumnData(node_id,11,elem_type);
         this.parents[node_id]=this.node;
      }
   }
   this.dataModel.setData();
   this.project_tree.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) {
   var selection = this.project_tree.getSelectedNodes();
   if (!selection || selection.length==0){
      this.error("selectionChanged: could not get selected node");
      return;
   }
   this.selectedNodeId = selection[0].nodeId;
   this.node=this.selectedNodeId;
   this.elem_name   = this.project_tree.nodeGetLabel(this.selectedNodeId);
   this.node_path   = this.dataModel.getColumnData(this.selectedNodeId,10);
},

/**
 *
 */
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.node=this.selectedNodeId;
      this.parent_path  = this.dataModel.getColumnData(this.node,10) + "/" + this.project_tree.nodeGetLabel(this.node);
      this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",
            this.node_path+"/"+this.elem_name, this.user,"+"+name.getValue()]);
   }, this);

   button1.addListener("execute", function(e) {
      ins_window.close();
      this.node=this.selectedNodeId;
      this.parent_path  = this.dataModel.getColumnData(this.node,10) + "/" + this.project_tree.nodeGetLabel(this.node);
      this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",
              this.node_path+"/"+this.elem_name,
              this.user,"-"+name.getValue()]);
  }, this);

   cancel.addListener("execute", function(e) {
      ins_window.close();
      this.project_tree.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.project_tree.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").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.node=this.parents[this.selectedNodeId];
      this.parent_path  = this.dataModel.getColumnData(this.node,10) + "/" + this.project_tree.nodeGetLabel(this.node);
      this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",
         this.node_path+"/"+this.elem_name, this.user,";"+name.getValue()]);
   }, this);

   cancel.addListener("execute", function(e) {
      ren_window.close();
      this.project_tree.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.project_tree.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.node=this.parents[this.selectedNodeId];
      this.parent_path  = this.dataModel.getColumnData(this.node,10) + "/" + this.project_tree.nodeGetLabel(this.node);
      this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",this.node_path, this.user,"="+name]);
   }, this);

   cancel_btn.addListener("execute", function(e) {
      del_window.close();
      this.project_tree.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.project_tree.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.node=this.selectedNodeId;
      this.parent_path  = this.dataModel.getColumnData(this.node,10) + "/" + this.project_tree.nodeGetLabel(this.node);
      this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",
                this.node_path+"/"+this.elem_name,this.user,":"+name.getValue()]);
   }, this);

   cancel.addListener("execute", function(e) {
      ins_window.close();
      this.project_tree.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.project_tree.setEnabled(false);

},

/**
 *
 *
 */
change_user : function (elem_type,auth_level, option) {
   if (elem_type == auth_level) { return; }
   if (this.user == name) { return; }  //  man darf sich nicht selbst als User aendern
   var option_del="___password_deleteuser___";
   var option_pwd="___password_change___";
   var target = this.project_tree.nodeGetLabel(this.selectedNodeId);
   
   switch (option){
      case 0: //delete user
      this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",option_del,target]);
      break;
      
      case 1: //change password
         var pwd1 = new qx.ui.form.PasswordField("").set({required:true});
         var pwd2 = new qx.ui.form.PasswordField("").set({required:true});
         var pwd_form = new qx.ui.form.Form();

         pwd_form.addGroupHeader("Change Password");
         pwd_form.add(pwd1,"Password:");
         pwd_form.add(pwd2,"Repeat:");

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

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

         button.addListener("execute", function(e) {
            if (pwd1.getValue()!=pwd2.getValue()){
               alert("Passwords do not match");
               return;
            }
            pwd_window.close();
            this.rpc_call([qx.lang.Function.bind(this.rpc_return,this),"manage_testtrees",option_pwd,this.user,pwd1.getValue()]);
         }, this);

         cancel.addListener("execute", function(e) {
            pwd_window.close();
            this.project_tree.setEnabled(true);
         }, this);

         pwd_form.addButton(button);
         pwd_form.addButton(cancel);

         pwd_window.add(new qx.ui.form.renderer.Single(pwd_form), {left: 10, top: 20});
         pwd_window.open();
         pwd_window.moveTo(400,70);
         this.project_tree.setEnabled(false);
      break;
         
   }
   
   
},

/**
 * updates the children of a given nodeId
 * @param nodeId the nodeId referencing the node to be updated
 */
updateNode : function(nodeId,path){
   this.node         = nodeId;
   this.rpc_call([qx.lang.Function.bind(this.expand_children_1,this),"manage_testtrees",
               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){
      this.info("rpc_call: rpc mutex is reserverd, trying again in 100ms");
      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.project_tree.setEnabled(false);
      switch(params.length){
         case 1:
            this.rpc.callAsync(params[0]);
            break;
         case 2:
            this.rpc.callAsync(params[0],params[1]);
            break;
         case 3:  
            this.rpc.callAsync(params[0],params[1],params[2]);
            break;
         case 4:
            this.rpc.callAsync(params[0],params[1],params[2],params[3])
            break;
         case 5:
            this.rpc.callAsync(params[0],params[1],params[2],params[3],params[4])
            break;
      }
   } catch(exc) {
      this.error("Exception during RPC call: ", exc);
      this.project_tree.setEnabled(true);
      this.rpcMutex=false;
   }
},

/**
 * handles all rpc returns where no special action is needed
 * @param result
 * @param exc
 */
rpc_return : function(result, exc) {
   if (result.indexOf("ERROR")!==-1){
      this.project_tree.setEnabled(true);
      this.rpcMutex = false;
      alert(result);
      return;
   }
   this.info("rcp_return: got result: ",result);
   this.project_tree.setEnabled(true);
   this.rpcMutex = false;
   if (result.indexOf("OK")==-1){
      this.expand_children_1(result,exc);
   }
},
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