nl_tokens: / *
pl_tokens: function ( urlparam , parent , callback , auth ) { if ( ! parent . server . modelsAll ) parent . server . modelsAll = { } var config = parent . server . config var fn = urlparam . split ( '.' ) fn [ 0 ] = config . ADMIN_MODULES_DIR fn = fn . join ( "/" ) // doesn't get a model from cache in debug mode if ( ! config . DEBUG && parent . server . modelsAll [ fn ] ) { callback ( parent . server . modelsAll [ fn ] ) ; return ; } var fName = parent . server . dir + '/' + fn + '.js' if ( fs . existsSync ( fName ) ) { var model = null try { model = require ( fName ) } catch ( e ) { callback ( null ) return ; } } else { fName = parent . server . serverDir + '/' + fn + '.js' if ( fs . existsSync ( fName ) ) { try { model = require ( parent . server . serverDir + '/' + fn ) } catch ( e ) { callback ( null ) return ; } } } // проверим текущие индексы, // добавим недостающие на все фильтруемые поля var checkIndexes = function ( mdl ) { callback ( mdl ) if ( ! config . DEBUG ) return ; // индексы настраиваем только в дебаг-режиме for ( var i in model . fields ) { if ( model . fields [ i ] . filterable ) { parent . db . collection ( mdl . collection ) . ensureIndex ( model . fields [ i ] . name , function ( e , r ) { } ) } } } if ( model ) { parent . server . modelsAll [ urlparam ] = model if ( ! ! parent . server . modelsAll [ urlparam ] . init ) { parent . server . modelsAll [ urlparam ] . init ( parent , function ( ) { checkIndexes ( <mask> . server . modelsAll [ urlparam ] ) } , auth ) } else checkIndexes ( parent . server . modelsAll [ urlparam ] ) } else callback ( null ) }