/** * * @author: Malishev Dmitry */ App.Templates.html = { WEB: { hint: [''], notification: [ '
  •  \  ~!:TOPIC~!\ ~!:NOTICE~!\
  • ' ] }, // file manager // FM: { reload_in_time: [ '
    \
    '+App.Constants.FM_HIT+' F5 '+App.Constants.FM_TO_RELOAD_THE_PAGE+'
    \
    ' ], entry_line: ['
  • \ \ \ \ \
    ~!:NAME~!
    \ ~!:PERMISSIONS~!\ ~!:OWNER~!\ ~!:SIZE_UNIT~!\ ~!:SIZE_VALUE~!\ ~!:DATE~!\ ~!:TIME~!\ \
  • '], popup_alert: [''], popup_bulk_remove: [''], popup_bulk_copy: [''], /*popup_bulk: [''],*/ popup_delete: [''], popup_copy: [''], popup_rename: ['
    \
    '+App.Constants.FM_RENAME+': "~!:FILENAME~!"
    \ \
    \
    \ \
    \
    \

    '+App.Constants.FM_CANCEL+'

    \

    '+App.Constants.FM_RENAME+'

    \
    \
    \

    '+App.Constants.FM_CANCEL+'

    \

    '+App.Constants.FM_RENAME+'

    \
    \
    '], popup_pack: ['
    \
    '+App.Constants.FM_PACK+' "~!:FILENAME~!"
    \
    \ \
    \
    \ \
    \

    '+App.Constants.FM_CANCEL+'

    \

    '+App.Constants.FM_PACK_BUTTON+'

    \
    \
    '], popup_unpack: ['
    \
    '+App.Constants.FM_EXTRACT+' "~!:FILENAME~!" '+App.Constants.FM_INTO_KEYWORD+':
    \
    \ \
    \
    \ \
    \

    '+App.Constants.FM_CANCEL+'

    \

    '+App.Constants.FM_EXTRACT+'

    \
    \
    '], popup_create_file: ['
    \
    '+App.Constants.FM_CREATE_FILE+'
    \ \
    \
    \ \
    \
    \

    '+App.Constants.FM_CANCEL+'

    \

    '+App.Constants.FM_CREATE+'

    \
    \
    '], popup_create_dir: ['
    \
    '+App.Constants.FM_CREATE_DIRECTORY+'
    \ \
    \
    \ \
    \
    \

    '+App.Constants.FM_CANCEL+'

    \

    '+App.Constants.FM_CREATE+'

    \
    \
    '], popup_no_file_selected: ['
    \
    Please select a file
    \
    \

    '+App.Constants.FM_OK+'

    \
    \
    '] } }; // Internals var Tpl = App.Templates; var Templator = function() { var init = function() { fb.info('Templator work'); Templator.splitThemAll(); Templator.freezeTplIndexes(); }; /** * Split the tpl strings into arrays */ Templator.splitThemAll = function(){ fb.info('splitting tpls'); jQuery.each(App.Templates.html, function(o){ //try{ var tpls = App.Templates.html[o]; jQuery.each(tpls, function(t){ tpls[t] = tpls[t][0].split('~!'); }); //}catch(e){fb.error('%o %o', o, e);} }); }, /** * Iterates tpls */ Templator.freezeTplIndexes = function(){ fb.info('freezing tpl keys'); jQuery.each(App.Templates.html, Templator.cacheTplIndexes); }, /** * Grab the tpl group key and process it */ Templator.cacheTplIndexes = function(key) { var tpls = App.Templates.html[key]; jQuery.each(tpls, function(o) { var tpl = tpls[o]; Templator.catchIndex(key, o, tpl); }); }, /** * Set the indexes */ Templator.catchIndex = function(key, ref_key, tpl) { 'undefined' == typeof App.Templates._indexes[key] ? App.Templates._indexes[key] = {} : false; 'undefined' == typeof App.Templates._indexes[key][ref_key] ? App.Templates._indexes[key][ref_key] = {} : false; jQuery(tpl).each(function(index, o) { if (':' == o.charAt(0)) { App.Templates._indexes[key][ref_key][o.toString()] = index; } }); } /** * Get concrete templates */ init(); return Templator; }; Templator.getTemplate = function(ns, key){ return [ App.Templates._indexes[ns][key], App.Templates.html[ns][key].slice(0) ]; } // init templator Tpl.Templator = Templator(); Tpl.get = function(key, group){ return Tpl.Templator.getTemplate(group, key); }