2012-02-23 07:05:32 +00:00
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
2011-06-08 09:07:15 +00:00
pscript [ 'onload_Permission Engine' ] = function ( ) {
2012-02-23 07:26:45 +00:00
// header and toolbar
var h = new PageHeader ( 'pe_header' , 'Permissions Manager' , 'Set specific permissions for Roles' )
if ( ! pscript . perm _engine ) pscript . perm _engine = new pscript . PermEngine ( ) ;
2011-06-08 09:07:15 +00:00
}
pscript . PermEngine = function ( ) {
2012-02-23 07:26:45 +00:00
// create UI elements
this . wrapper = $i ( 'perm_engine_div' ) ;
this . head = $a ( this . wrapper , 'div' ) ;
this . body = $a ( this . wrapper , 'div' ) ;
this . footer = $a ( this . wrapper , 'div' ) ;
var lab = $a ( this . body , 'div' , '' , { backgroundColor : '#FFD' , padding : '8px' , margin : '16px 0px' } ) ;
lab . innerHTML = 'Please select the item for which you want to set permissions' ;
this . make _head ( ) ;
this . load _options ( ) ;
2011-06-08 09:07:15 +00:00
}
// Make Head
// -------------
pscript . PermEngine . prototype . make _head = function ( ) {
2012-02-23 07:26:45 +00:00
var me = this ;
var make _select = function ( label ) {
var w = $a ( me . head , 'div' , '' , { margin : '8px 0px' } ) ;
var t = make _table ( w , 1 , 2 , '300px' , [ '50%' , '50%' ] ) ;
$td ( t , 0 , 0 ) . innerHTML = label ;
var s = $a ( $td ( t , 0 , 1 ) , 'select' , '' , { width : '140px' } ) ;
s . wrapper = w ;
return s ;
}
var make _button = function ( label , parent , green ) {
return $btn ( parent , label , null , { margin : '8px 0px' , display : 'none' } , ( green ? 'green' : null ) ) ;
}
// Set Permissions for
this . type _select = make _select ( 'Set Permissions For' ) ;
this . type _select . onchange = function ( ) {
me . get _permissions ( ) ;
}
// Update Button
this . add _button = make _button ( '+ Add A New Rule' , this . head , 0 ) ;
this . add _button . onclick = function ( ) {
me . add _permission ( ) ;
}
// Update Button
this . update _button = make _button ( 'Update' , this . footer , 1 ) ;
this . update _button . onclick = function ( ) {
me . update _permissions ( ) ;
}
2011-06-08 09:07:15 +00:00
}
// Add Permissions
// -----------------
pscript . PermEngine . prototype . add _permission = function ( ) {
2012-02-23 07:26:45 +00:00
var me = this ;
if ( ! this . add _permission _dialog ) {
// dialog
var d = new Dialog ( 400 , 400 , 'Add Permission' ) ;
d . make _body ( [ [ 'Select' , 'Role' ] , [ 'Select' , 'Level' ] , [ 'Button' , 'Add' ] ] )
add _sel _options ( d . widgets [ 'Role' ] , this . roles , '' ) ;
add _sel _options ( d . widgets [ 'Level' ] , [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] , 0 ) ;
// add
d . widgets [ 'Add' ] . onclick = function ( ) {
if ( ! sel _val ( d . widgets [ 'Role' ] ) ) {
msgprint ( 'Please select Role' ) ; return ;
}
var callback = function ( r , rt ) {
// reload
me . get _permissions ( ) ;
d . hide ( ) ;
}
$c _obj ( 'Permission Control' , 'add_permission' , JSON . stringify ( [ sel _val ( me . type _select ) , sel _val ( d . widgets [ 'Role' ] ) , sel _val ( d . widgets [ 'Level' ] ) ] ) , callback ) ;
}
this . add _permission _dialog = d ;
}
this . add _permission _dialog . show ( ) ;
2011-06-08 09:07:15 +00:00
}
// Hide Fields
// -----------------
pscript . PermEngine . prototype . hide _fields = function ( ) {
2012-02-23 07:26:45 +00:00
$dh ( this . role _select . wrapper ) ;
this . type _select . disabled = false ;
this . body . innerHTML = '' ;
2011-06-08 09:07:15 +00:00
}
// Load Roles And Modules
// -----------------------
pscript . PermEngine . prototype . load _options = function ( ) {
2012-02-23 07:26:45 +00:00
var me = this ;
$dh ( me . update _button ) ;
$dh ( me . add _button ) ;
$c _obj ( 'Permission Control' , 'get_doctype_list' , '' , function ( r , rt ) {
me . roles = r . message . roles ;
// Type
empty _select ( me . type _select ) ;
add _sel _options ( me . type _select , add _lists ( [ '' ] , r . message . doctypes ) ) ;
} ) ;
2011-06-08 09:07:15 +00:00
}
// Get DocType and Permissions related to module
// --------------------------------------------------
pscript . PermEngine . prototype . get _permissions = function ( ) {
2012-02-23 07:26:45 +00:00
var me = this ;
if ( ! sel _val ( me . type _select ) ) {
msgprint ( 'Please select a type first!' ) ; return ;
}
$c _obj ( 'Permission Control' , 'get_permissions' , sel _val ( me . type _select ) , function ( r , rt ) {
// Get permissions
if ( r . message . perms . length ) {
me . get _results ( r . message ) ;
}
else me . body . innerHTML = '<div style = "color : red; margin:8px 0px;">No Records Found</div>'
pscript . show _submittable ( ) ;
} ) ;
2011-06-08 09:07:15 +00:00
}
// Get Results
// ------------------
pscript . PermEngine . prototype . get _results = function ( r ) {
2012-02-23 07:26:45 +00:00
var perms = r . perms ;
var me = this ;
var doctype = sel _val ( me . type _select ) ;
// show update button
$ds ( me . update _button ) ;
$ds ( me . add _button ) ;
this . body . innerHTML = ''
pscript . all _checkboxes = [ ] ;
pscript . all _matches = [ ] ;
var head = $a ( this . body , 'h3' ) ; head . innerHTML = 'Rules for ' + doctype ;
var permt = make _table ( me . body , perms . length + 1 , 9 , '80%' , [ ] , { border : '1px solid #AAA' , padding : '3px' , verticalAlign : 'middle' , height : '30px' } ) ;
// Create Grid for particular DocType
// ------------------------------------
// Columns
var col _labels = [ 'Role' , 'Level' , 'Read' , 'Write' , 'Create' , 'Submit' , 'Cancel' , 'Amend' , 'Restrict By' ]
for ( var n = 0 ; n < col _labels . length ; n ++ ) {
$y ( $td ( permt , 0 , n ) , { backgroundColor : '#DDD' , width : ( n == 0 ? '30%' : ( n == 8 ? '21%' : '7%' ) ) } )
$td ( permt , 0 , n ) . innerHTML = col _labels [ n ] ;
$td ( permt , 0 , n ) . fieldname = col _labels [ n ] . toLowerCase ( ) ;
}
// Rows for Column Level / Role
for ( var j = 0 ; j < perms . length ; j ++ ) {
var plevel = $a ( $td ( permt , j + 1 , 1 ) , 'span' , 'link_type' ) ;
plevel . innerHTML = perms [ j ] . permlevel ;
plevel . doctype = doctype ;
plevel . value = perms [ j ] . permlevel ;
plevel . onclick = function ( ) { me . get _fields ( this . doctype , this . value ) }
// role
$td ( permt , j + 1 , 0 ) . innerHTML = perms [ j ] . role ;
}
// Get values
for ( var l = 0 ; l < perms . length ; l ++ ) {
for ( var m = 0 ; m < 6 ; m ++ ) { // (read,write,create,submit,cancel,amend)
var chk = $a _input ( $td ( permt , l + 1 , m + 2 ) , 'checkbox' ) ;
var val = perms [ l ] [ $td ( permt , 0 , m + 2 ) . fieldname ] ;
if ( val == 1 ) chk . checked = 1 ;
else chk . checked = 0 ;
if ( m == 3 ) { chk . onclick = pscript . show _submittable }
chk . doctype = doctype ;
chk . permlevel = perms [ l ] . permlevel ; chk . perm _type = col _labels [ m + 2 ] . toLowerCase ( ) ; chk . role = perms [ l ] . role ;
pscript . all _checkboxes . push ( chk ) ;
}
}
// add selects for match
me . add _match _select ( r , perms , permt , doctype ) ;
2011-06-08 09:07:15 +00:00
}
2012-02-23 07:26:45 +00:00
// Show submittable warning
pscript . show _submittable = function ( ) {
var submittable = 0 ;
for ( i in pscript . all _checkboxes ) {
c = pscript . all _checkboxes [ i ] ;
if ( c . perm _type == 'submit' && c . checked ) {
submittable = 1 ;
break ;
}
}
if ( submittable ) {
$ ( '#submittable_warning' ) . toggle ( true ) ;
} else {
$ ( '#submittable_warning' ) . toggle ( false ) ;
}
}
2011-06-08 09:07:15 +00:00
// render selects for match
// --------------------------------------------
pscript . PermEngine . prototype . add _match _select = function ( r , perms , permt , doctype ) {
2012-02-23 07:26:45 +00:00
var me = this ;
// add select for match
for ( var i = 0 ; i < perms . length ; i ++ ) {
if ( perms [ i ] . permlevel == 0 ) {
// select
var sel = $a ( $td ( permt , i + 1 , 8 ) , 'select' , '' , { width : '100%' } ) ;
add _sel _options ( sel , r . fields ) ;
sel . details = perms [ i ] ; sel . details . parent = doctype ;
sel . onchange = function ( ) {
if ( sel _val ( this ) && sel _val ( this ) != 'owner' ) $ds ( this . div ) ;
else $dh ( this . div ) ; }
// link
var div = $a ( $td ( permt , i + 1 , 8 ) , 'div' , 'link_type' , { marginTop : '2px' , fontSize : '10px' , display : 'none' } ) ;
div . onclick = function ( ) { this . details . match = sel _val ( this . sel ) ; me . show _match _dialog ( this . details ) ; }
div . innerHTML = 'Set Users / Roles' ;
div . details = perms [ i ] ;
sel . div = div ; div . sel = sel ;
// set the value
if ( perms [ i ] . match ) { sel . value = perms [ i ] . match ; $ds ( div ) ; }
pscript . all _matches . push ( sel ) ;
}
}
2011-06-08 09:07:15 +00:00
}
// match users Dialog
// =======================================================
pscript . PermEngine . prototype . show _match _dialog = function ( details ) {
2012-02-23 07:26:45 +00:00
if ( ! this . match _defaults _dialog ) {
var d = new Dialog ( 750 , 500 , 'Permission Applies To' ) ;
d . make _body ( [ [ 'HTML' , 'Body' ] ] ) ;
var w = d . widgets [ 'Body' ] ;
$y ( w , { height : '350px' , overflow : 'auto' } ) ;
this . match _defaults _dialog = d ;
}
// dialog
this . match _defaults _dialog . show ( ) ;
// render the rules
var me = this ;
var callback = function ( r , rt ) {
me . render _match _dialog ( r , details ) ;
}
// load the rules
$c _obj ( 'Permission Control' , 'get_defaults' , details . match + '~~~' + ( this . profiles ? 'No' : 'Yes' ) , callback ) ;
2011-06-08 09:07:15 +00:00
}
// --------------------------------------------
pscript . PermEngine . prototype . render _match _dialog = function ( r , details ) {
2012-02-23 07:26:45 +00:00
var d = this . match _defaults _dialog ;
var w = d . widgets [ 'Body' ] ;
w . innerHTML = '<div style="background-color:#FFD; padding: 4px; color: #440; margin-bottom:16px">Please Note: Any action will also affect other permissions with similar rules!</div>'
// header
var t = make _table ( $a ( w , 'div' , '' , { borderBottom : '1px solid #AAA' } ) , 1 , 3 , '90%' , [ '40%' , '40%' , '20%' ] , { fontWeight : 'bold' , padding : '3px' , fontSize : '14px' } ) ;
$td ( t , 0 , 0 ) . innerHTML = 'Who?' ; $td ( t , 0 , 1 ) . innerHTML = 'Is allowed if ' + details . match + ' equals' ;
// existing defaults
var dl = r . message . dl ; this . options = r . message . ol ;
if ( ! this . profiles ) {
this . profiles = r . message . pl ;
}
for ( var i = 0 ; i < dl . length ; i ++ ) {
new MatchDefaultValue ( this , w , dl [ i ] , details . match ) ;
}
this . add _new _match _row ( details . match ) ;
2011-06-08 09:07:15 +00:00
}
pscript . PermEngine . prototype . add _new _match _row = function ( fieldname ) {
2012-02-23 07:26:45 +00:00
// add new default
new MatchDefaultValue ( this , this . match _defaults _dialog . widgets [ 'Body' ] , null , fieldname , 1 ) ;
}
2011-06-08 09:07:15 +00:00
// --------------------------------------------
MatchDefaultValue = function ( pe , parent , details , fieldname , editable ) {
2012-02-23 07:26:45 +00:00
this . pe = pe ;
this . wrapper = $a ( parent , 'div' , '' , { margin : '4px' } ) ;
this . clear ( ) ;
this . details = details ;
this . fieldname = fieldname ;
this . render ( editable ) ;
2011-06-08 09:07:15 +00:00
}
// --------------------------------------------
MatchDefaultValue . prototype . clear = function ( ) {
2012-02-23 07:26:45 +00:00
this . wrapper . innerHTML = '' ;
this . tab = make _table ( this . wrapper , 1 , 3 , '90%' , [ '40%' , '40%' , '20%' ] , { verticalAlign : 'middle' , padding : '3px' } ) ;
2011-06-08 09:07:15 +00:00
}
// --------------------------------------------
MatchDefaultValue . prototype . render = function ( editable ) {
2012-02-23 07:26:45 +00:00
if ( editable ) {
this . render _editable ( ) ;
} else {
this . render _static ( ) ;
}
2011-06-08 09:07:15 +00:00
}
// --------------------------------------------
MatchDefaultValue . prototype . render _editable = function ( ) {
2012-02-23 07:26:45 +00:00
var me = this ;
// profile or role
this . profile _or _role = $a ( $td ( this . tab , 0 , 0 ) , 'select' , '' , { width : '60px' , marginRight : '8px' } ) ;
add _sel _options ( this . profile _or _role , [ 'Profile' , 'Role' ] , 'Profile' ) ;
this . profile _or _role . onchange = function ( ) {
if ( sel _val ( this ) == 'Profile' ) { $di ( me . profile _sel ) ; $dh ( me . role _sel ) ; }
else { $dh ( me . profile _sel ) ; $di ( me . role _sel ) ; }
}
// role sel
this . role _sel = $a ( $td ( this . tab , 0 , 0 ) , 'select' , '' , { width : '100px' , display : 'none' } ) ;
add _sel _options ( this . role _sel , this . pe . roles ) ;
// profile sel
this . profile _sel = $a ( $td ( this . tab , 0 , 0 ) , 'select' , '' , { width : '100px' } ) ;
add _sel _options ( this . profile _sel , this . pe . profiles ) ;
// options sel
this . options _sel = $a ( $td ( this . tab , 0 , 1 ) , 'select' , '' , { width : '120px' } ) ;
add _sel _options ( this . options _sel , this . pe . options ) ;
// add
var span = $a ( $td ( this . tab , 0 , 2 ) , 'span' , 'link_type' , { marginLeft : '8px' } ) ;
span . innerHTML = 'Add'
span . onclick = function ( ) { me . save ( ) ; }
2011-06-08 09:07:15 +00:00
}
// --------------------------------------------
MatchDefaultValue . prototype . render _static = function ( ) {
2012-02-23 07:26:45 +00:00
var me = this ;
$td ( this . tab , 0 , 0 ) . innerHTML = this . details . parenttype ;
$td ( this . tab , 0 , 0 ) . innerHTML += ' ' + this . details . parent ;
$td ( this . tab , 0 , 1 ) . innerHTML = this . details . defvalue ;
// delete
var span = $a ( $td ( this . tab , 0 , 2 ) , 'span' , 'link_type' , { marginLeft : '8px' } ) ;
span . innerHTML = 'Cancel'
span . onclick = function ( ) { me . delete _def ( ) ; }
2011-06-08 09:07:15 +00:00
}
// --------------------------------------------
MatchDefaultValue . prototype . delete _def = function ( ) {
2012-02-23 07:26:45 +00:00
var me = this ;
this . wrapper . innerHTML = '<div style="color: #888; padding: 3px;">Deleting...</div>' ;
var callback = function ( r , rt ) {
$dh ( me . wrapper ) ;
if ( r . exc ) msgprint ( 'There were errors!' )
}
$c _obj ( 'Permission Control' , 'delete_default'
, [ this . details . parent , this . fieldname , this . details . defvalue ] . join ( '~~~' )
, callback )
2011-06-08 09:07:15 +00:00
}
// --------------------------------------------
MatchDefaultValue . prototype . save = function ( ) {
2012-02-23 07:26:45 +00:00
var me = this ;
var callback = function ( r , rt ) {
me . details = r . message ;
me . clear ( ) ;
me . render ( ) ;
me . pe . add _new _match _row ( me . fieldname ) ;
}
// values
if ( sel _val ( this . profile _or _role ) == 'Profile' ) { var parent = sel _val ( this . profile _sel ) ; var parenttype = 'Profile' ; }
else { var parent = sel _val ( this . role _sel ) ; var parenttype = 'Role' ; }
if ( ! sel _val ( this . options _sel ) || ! parent ) { msgprint ( "Please select all values" ) ; return ; }
$c _obj ( 'Permission Control' , 'add_default'
, [ parent , parenttype , this . fieldname , sel _val ( this . options _sel ) ] . join ( '~~~' )
, callback ) ;
this . wrapper . innerHTML = '<div style="color: #888; padding: 3px;">Adding...</div>' ;
2011-06-08 09:07:15 +00:00
}
// Make Dialog Box To Get Fields fro PermLevel
// =======================================================
pscript . PermEngine . prototype . make _fields _dialog = function ( ) {
2012-02-23 07:26:45 +00:00
if ( ! pscript . get _field _dialog ) {
pscript . get _field _dialog = new Dialog ( 750 , 500 , 'Fields' ) ;
pscript . get _field _dialog . make _body ( [ [ 'HTML' , 'Fields' , '<div id="perm_engine_get_fields"></div>' ] , [ 'Button' , 'OK' ] ] ) ;
}
else $i ( 'perm_engine_get_fields' ) . innerHTML = '' ;
2011-06-08 09:07:15 +00:00
}
// Get Fields
// --------------------
pscript . PermEngine . prototype . get _fields = function ( dt , permlevel ) {
2012-02-23 07:26:45 +00:00
var me = this ;
var callback = function ( r , rt ) {
// Get Parent DocType Fields
var parent _fields _dict = r . message . parent _fields _dict ;
// Get Child Table Fields if any
var table _fields _dict = r . message . table _fields _dict ;
// Make Fields Dialog Box
me . make _fields _dialog ( ) ;
me . make _fields _table ( dt , parent _fields _dict , table _fields _dict , permlevel ) ;
pscript . get _field _dialog . show ( ) ;
pscript . get _field _dialog . widgets [ 'OK' ] . onclick = function ( ) {
pscript . get _field _dialog . hide ( ) ;
}
}
var args = "{'dt':'" + dt + "','permlevel':" + permlevel + "}"
$c _obj ( 'Permission Control' , 'get_fields' , args , callback ) ;
2011-06-08 09:07:15 +00:00
}
// Make Table of Fields for Dialog Box
// --------------------------------------
pscript . PermEngine . prototype . make _fields _table = function ( dt , parent _fields _dict , table _fields _dict , permlevel ) {
2012-02-23 07:26:45 +00:00
var make _grid = function ( table , fields _dict ) {
var col _labels = [ 'Label' , 'Fieldtype' , 'Fieldname' , 'Options' ] ;
for ( var n = 0 ; n < col _labels . length ; n ++ ) {
$a _input ( ( $td ( table , 0 , n ) ) , 'data' ) ;
$td ( table , 0 , n ) . innerHTML = '<b>' + col _labels [ n ] + '</b>' ;
$td ( table , 0 , n ) . fieldname = col _labels [ n ] . toLowerCase ( ) ;
}
// Add values
for ( var i = 0 ; i < keys ( fields _dict ) . length ; i ++ ) {
for ( var j = 0 ; j < 4 ; j ++ ) {
$a _input ( ( $td ( table , i + 1 , j ) ) , 'data' ) ;
$td ( table , i + 1 , j ) . innerHTML = cstr ( fields _dict [ i ] [ $td ( table , 0 , j ) . fieldname ] )
}
}
}
$i ( 'perm_engine_get_fields' ) . innerHTML = '<b>' + dt + ' Fields at Level ' + permlevel + ':</b><br><br>' ;
var parent _field _table = make _table ( 'perm_engine_get_fields' , keys ( parent _fields _dict ) . length + 1 , 4 , '100%' , [ '25%' , '25%' , '25%' , '25%' ] , { border : '1px solid #AAA' , padding : '2px' } ) ;
make _grid ( parent _field _table , parent _fields _dict ) ;
child _tables = keys ( table _fields _dict )
if ( child _tables . length > 0 ) {
for ( var k = 0 ; k < child _tables . length ; k ++ ) {
var tab _fields _det = table _fields _dict [ child _tables [ k ] ] ;
if ( keys ( tab _fields _det ) . length > 0 ) {
$i ( 'perm_engine_get_fields' ) . innerHTML += '<br><b>' + child _tables [ k ] + ' Fields at Level ' + permlevel + ':</b><br><br>'
var child _field _table = make _table ( 'perm_engine_get_fields' , keys ( tab _fields _det ) . length + 1 , 4 , '100%' , [ '25%' , '25%' , '25%' , '25%' ] , { border : '1px solid #AAA' , padding : '2px' } ) ;
make _grid ( child _field _table , tab _fields _det ) ;
}
}
}
2011-06-08 09:07:15 +00:00
}
// Update Permissions
// -----------------------
pscript . PermEngine . prototype . update _permissions = function ( ) {
2012-02-23 07:26:45 +00:00
var me = this ;
var out = { } ;
var add _to _out = function ( doctype , permlevel , role , key , value ) {
if ( ! out [ doctype ] ) out [ doctype ] = { } ;
if ( ! out [ doctype ] [ permlevel ] ) out [ doctype ] [ permlevel ] = { } ;
if ( ! out [ doctype ] [ permlevel ] [ role ] ) out [ doctype ] [ permlevel ] [ role ] = { } ;
out [ doctype ] [ permlevel ] [ role ] [ key ] = value ;
}
// check boxes
for ( i in pscript . all _checkboxes ) {
c = pscript . all _checkboxes [ i ] ;
add _to _out ( c . doctype , c . permlevel , c . role , c . perm _type , c . checked ? 1 : 0 ) ;
}
// matches
for ( var i = 0 ; i < pscript . all _matches . length ; i ++ ) {
var s = pscript . all _matches [ i ] ;
if ( sel _val ( s ) )
add _to _out ( s . details . parent , s . details . permlevel , s . details . role , 'match' , sel _val ( s ) ) ;
}
var args = "{'perm_dict': " + JSON . stringify ( out ) + "}"
$c _obj ( 'Permission Control' , 'update_permissions' , args , function ( r , rt ) { } ) ;
2011-06-08 09:07:15 +00:00
}
// Update Page Roles
// ----------------------
pscript . PermEngine . prototype . update _page _roles = function ( ) {
2012-02-23 07:26:45 +00:00
var me = this ;
var out = { } ;
for ( i in pscript . all _pg _checkboxes ) {
c = pscript . all _pg _checkboxes [ i ] ;
out [ c . page _name ] = c . checked ? 1 : 0
}
var args = "{'page_role_dict': " + JSON . stringify ( out ) + ", 'role': '" + sel _val ( me . role _select ) + "'}"
$c _obj ( 'Permission Control' , 'update_page_role' , args , function ( r , rt ) { } ) ;
2011-06-08 09:07:15 +00:00
}
// Reset Permission Engine
// -------------------------
pscript . PermEngine . prototype . reset _perm _engine = function ( ) {
2012-02-23 07:26:45 +00:00
this . type _select . selectedIndex = 0 ;
this . load _options ( ) ;
2011-06-08 09:07:15 +00:00
}