diff --git a/ChangeLog b/ChangeLog index 8cda2460..c7760eac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -54,6 +54,8 @@ getJSONfromFileTable. * Removed init property from view and edit. +* FilePicker gets key from modules.json. + 2012.04.22, v0.2.0 diff --git a/lib/client/storage/_filepicker.js b/lib/client/storage/_filepicker.js index d029fc59..c9f1c898 100644 --- a/lib/client/storage/_filepicker.js +++ b/lib/client/storage/_filepicker.js @@ -1,5 +1,4 @@ var CloudCmd, Util, DOM, $, filepicker; -/* module for work with filepicker */ (function(CloudCmd, Util, DOM){ 'use strict'; @@ -43,14 +42,20 @@ var CloudCmd, Util, DOM, $, filepicker; function load(pCallBack){ console.time('filepicker load'); - var lHTTP = "https:"===document.location.protocol? "https:" : "http:"; + var lHTTP = document.location.protocol; DOM.jsload(lHTTP + '//api.filepicker.io/v1/filepicker.js', function(){ - filepicker.setKey('AACq5fTfzRY2E_Rw_4kyaz'); - DOM.Images.hideLoad(); - console.timeEnd('filepicker loaded'); - Util.exec(pCallBack); - }); + CloudCmd.getModules(function(pModules){ + var lStorage = Util.findObjByNameInArr(pModules, 'storage'), + lFilePicker = Util.findObjByNameInArr(lStorage, 'FilePicker'), + lKey = lFilePicker && lFilePicker.key; + + filepicker.setKey(lKey); + DOM.Images.hideLoad(); + console.timeEnd('filepicker loaded'); + Util.exec(pCallBack); + }); + }); } };