JQuery Tree's branches closing

For those who already work with JQuery Tree plugin, maybe you need to open only one branch at time, closing others. Here is how I resolved this problem :

  $('#tree').tree({
    callback: {
      onOpen: function(NODE, TREE_OBJ) {
        // fermeture des branches suivantes
       closeNextBranches(TREE_OBJ.next(NODE, true), TREE_OBJ);
        // fermeture des branches précédentes
        closePrevBranches(TREE_OBJ.prev(NODE, true), TREE_OBJ);
      }
    }
  });
  function closeNextBranches(NODE, TREE_OBJ) {
    TREE_OBJ.close_branch.call(TREE_OBJ, NODE);
    if (TREE_OBJ.next(NODE, true) != false) {
     closeNextBranches(TREE_OBJ.next(NODE, true), TREE_OBJ);
    }
  }
  function closePrevBranches(NODE, TREE_OBJ) {
    TREE_OBJ.close_branch.call(TREE_OBJ, NODE);
    if (TREE_OBJ.prev(NODE, true) != false) {
      closePrevBranches(TREE_OBJ.prev(NODE, true), TREE_OBJ);
    }
  }

I hope this piece of code will help you. Don't hesitate to give me other solutions.

Crud version 1.1

Well, here's an improved version of the Crud. It took time! Excuse me, I'm pretty busy.

I have not included the library Zend, you will need to download it
yourself and put it in the folder 'library'. Please, put Zend's
files  subfolder 'Zend'.

Download

Creative Commons License
Lesauf crud by FotsoTeketchuet Stephane is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Based on a work from sekaijin.ovh.org.

Zend menu generator

Here I present you a menu generator for Zend applications. The key feature is the integration with ACL rules.

It is composed  of three files :

  • menu.ini, contain menu description;

  • showMenu.php, helper to display menu;

  • menu.css, CSS stylesheet.

Menu.ini

; Patient

patient.name = Patient
patient.controller = patient
patient.action = show-list
patient.sub.add.name = Register new
patient.sub.add.controller = patient
patient.sub.add.action = add
patient.sub.list.name = Manage patients
patient.sub.list.controller = patient
patient.sub.list.action = show-list
patient.sub.quittance.name = Register quittance
patient.sub.quittance.controller = quittance
patient.sub.quittance.action = add

; Test
test.name = Test
test.controller = test
test.action = show-list
test.sub.add.name = Register new
test.sub.add.controller = test
test.sub.add.action = add
test.sub.list.name = Manage tests
test.sub.list.controller = test
test.sub.list.action = show-list

ShowMenu.php

It is the helper. Download it.

menu.css

This is the css for a css only menu. It is included in the ShowMenu.zip file. I found it on a website, but I don't remember the name. Sorry.

I hope you will enjoy. You are free to modify this code. If you do, I will appreciate to know it.

Lesauf Labtest : presentation

I am currently working on developing an application for monitoring tests in a laboratory for medical analyses. The features at the moment are quite simple:

  • Registration, changing patients; 
  • Records, changing tests available;
  • Selection of tests for a patient;
  • Edition, printing of test results;
  • Printing receipts;
  • Management of access rights.

I also intended to integrate management of stock, but is noted for later.

I work with the Zend framework and I have yet to integrate a lot of Ajax in the application.

I do sign as soon as the first stable version is ready.

Error on geomap script

Hi,

There was an error on geomap script. It use the getElementsByClassName method, which is no more supported in recent navigators. So I uses this script found on about.com

  /**
   * Implement the getElementsByClassName
   */    
  document.getElementsByClassName = function(cl) {
    var retnode = [];
    var myclass = new RegExp('\\b'+cl+'\\b');
    var elem = this.getElementsByTagName('*');
    for (var i = 0; i < elem.length; i++) {
      var classes = elem[i].className;
      if (myclass.test(classes)) {
        retnode.push(elem[i]);
      }
    }
    return retnode;
  };

You just have to insert this code in the script.

Syndicate content