OSDN Git Service

client is version0.4.21, brush up around boot application.
[pettanr/pettanr.git] / public / assets / system.js
index 22c8c97..7710a75 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * pettanR system.js
- *   version 0.4.20
+ *   version 0.4.21
  *   
  * author:
  *   itozyun
@@ -388,6 +388,14 @@ pettanr.file = ( function(){
                        }
                        return -1;
                },
+               getChildFileByIndex: function( _index ){
+                       var _access = FILE_CONTROLER.getFileDataAccess( this ),
+                               _children = FILE_CONTROLER.getChildren( this );
+                       if( typeof _index !== 'number' || _index < 0 || Type.isArray( _children ) === false || _index >= _children.length) return null;
+                       var _file = new FileClass( _access.TREE, _access.DATA, _children[ _index ]);
+                       // _file.init();
+                       return _file;
+               },
                getName: function(){
                        var driver = FILE_CONTROLER.getDriver( this );
                        if( typeof driver.getName === 'function'){
@@ -473,14 +481,6 @@ pettanr.file = ( function(){
                onDelete: function(){
                        
                },
-               getChildFileByIndex: function( _index ){
-                       var _access = FILE_CONTROLER.getFileDataAccess( this ),
-                               _children = FILE_CONTROLER.getChildren( this );
-                       if( typeof _index !== 'number' || _index < 0 || Type.isArray( _children ) === false || _index >= _children.length) return null;
-                       var _file = new FileClass( _access.TREE, _access.data, _children[ _index ]);
-                       // _file.init();
-                       return _file;
-               },
                move: function( _newFolder, _newIndex, opt_callback ){
                        var _access = FILE_CONTROLER.getFileDataAccess( this );
                        _access.TREE.move( _access.parentData, this.getUID(), _newFolder, _newIndex, opt_callback );
@@ -891,7 +891,7 @@ pettanr.finder = ( function(){
                                
                        },
                        destroy: function(){
-                               elmContainer.removeChild( ELM_WRAPPER);
+                               elmContainer.removeChild( ELM_WRAPPER );
                                file && file.destroy();
                                file = elmContainer = onDownCallback = onEditorCallback = onViewerCallback = onActionCallback = viewerList = editorList = null;
                                FINDER_ICON_POOL.push( instansce);
@@ -978,6 +978,7 @@ pettanr.finder = ( function(){
                        instance = this;
                        
                tree.addTreeEventListener( pettanr.file.TREE_EVENT.UPDATE, draw );
+               ELM_CONTAINER.appendChild( elmContainer );
                
                function draw( _w, _h ){
                        w = Type.isFinite( _w ) === true ? _w : w;
@@ -1057,20 +1058,16 @@ pettanr.finder = ( function(){
                this.init = function(){
                        //$( elmLocation).click( onHeadClick);
                        //$( elmContainer).click( onBodyClick);
-                       var position = pettanr.util.getAbsolutePosition( elmLocation);
+                       var position = pettanr.util.getAbsolutePosition( elmLocation );
                        headX = position.x;
                        headY = position.y;
                        bodyY = pettanr.util.getAbsolutePosition( elmBody ).y;
                        delete instance.init;
                }
-               this.onOpen = function( _w, _h, _option ){
-                       instance.init && instance.init();
-                       draw( _w, _h );
-               }
-               this.onClose = function(){
-                       return true;
-               }
                this.onPaneResize = function( _w, _h ){
+                       instance.init && instance.init();
+                       draw( _w, _h );                 
+                       
                        w = _w;
                        h = _h;
                        elmBody.style.height = ( _h - headH ) + 'px';
@@ -1108,7 +1105,9 @@ pettanr.finder = ( function(){
                init: function(){
                        
                },
-               createFinder: function( _elmTarget, _tree, _header, _footer ){
+               createFinder: function( _applicationReference, _elmTarget, _tree, _header, _footer ){
+                       if( pettanr.view.isApplicationReference( _applicationReference ) === false ) return;
+                       
                        var _finder = new FinderClass( _elmTarget, _tree, _header, _footer );
                        FINDER_ARRAY.push( _finder );
                        return _finder;
@@ -1294,7 +1293,8 @@ pettanr.driver = ( function(){
                        name:           'My Comics',
                        type:           pettanr.file.FILE_TYPE.FOLDER,
                        children:       [],
-                       driver:         Driver
+                       driver:         Driver,
+                       id:                     MyAuthorID
                },
                FILE_DATA_LATEST_COMICS = {
                        name:           'Latest Comics',
@@ -1306,7 +1306,8 @@ pettanr.driver = ( function(){
                        type:           pettanr.file.FILE_TYPE.FOLDER,
                        children:       [],
                        driver:         Driver,
-                       json:           pettanr.CONST.URL_ORIGINAL_PICTURES_JSON
+                       json:           pettanr.CONST.URL_ORIGINAL_PICTURES_JSON,
+                       id:                     MyArtistID
                },
                FILE_DATA_AUTHOR_ROOT = {
                        name:           'Authors',
@@ -1506,7 +1507,11 @@ pettanr.driver = ( function(){
                        if( _artist){
                                _data.artist = _artist = buildFileData( _artist, FILE_DATA_ARTIST_ROOT );
                                addChildData( _artist, _data );
-                               _artist.id === MyArtistID && addChildData( FILE_DATA_MY_PICTURES_ROOT, _data );
+                               if( _artist.id === MyArtistID ){
+                                       addChildData( FILE_DATA_MY_PICTURES_ROOT, _data );
+                                       //FILE_DATA_MY_PICTURES_ROOT.type = pettanr.driver.FILE_TYPE.ARTIST;
+                                       //FILE_DATA_MY_PICTURES_ROOT.id = MyArtistID;
+                               }
                        }
                }
                return _data;
@@ -1549,6 +1554,9 @@ pettanr.driver = ( function(){
                _getAPI: function(){
                        return FileAPI;
                },
+               _getMyPicturesData: function(){
+                       return FILE_DATA_MY_PICTURES_ROOT;
+               },
                FILE_TYPE: {
                        COMIC:                          FileAPI.createFileTypeID(),
                        PANEL:                          FileAPI.createFileTypeID(),
@@ -1588,12 +1596,12 @@ pettanr.cabinet = pettanr.view.registerApplication( function(){
        this.displayName = 'Comic list';
        this.ID          = 'Comiclist';
        this.rootElement = elmContainer;
-       this.onOpen = function( _w, _h, _option ){
-               finder = finder || pettanr.finder.createFinder( elmContainer, pettanr.driver.createComicTree() );
-               finder.open( _w, _h - pageHeaderH, _option );
+       this.onOpen = function( _w, _h ){
+               finder = finder || pettanr.finder.createFinder( pettanr.cabinet, elmContainer, pettanr.driver.createComicTree() );
+               finder.resize( _w, _h - pageHeaderH );
        }
        this.onClose = function(){
-               finder.close();
+               // finder.close();
        }
        this.onPaneResize = function( _w, _h){
                finder.resize( _w, _h - pageHeaderH );
@@ -1610,12 +1618,12 @@ pettanr.gallery = pettanr.view.registerApplication( function(){
        this.displayName = 'Pictures';
        this.ID          = 'pictures';
        this.rootElement = elmContainer;
-       this.onOpen = function( _w, _h, _option ){
-               finder = finder || pettanr.finder.createFinder( elmContainer, pettanr.driver.createPictureTree() );
-               finder.open( _w, _h - pageHeaderH, _option );
+       this.onOpen = function( _w, _h ){
+               finder = finder || pettanr.finder.createFinder( pettanr.gallery, elmContainer, pettanr.driver.createPictureTree() );
+               finder.resize( _w, _h - pageHeaderH );
        }
        this.onClose = function(){
-               finder.close();
+               // finder.close();
        }
        this.onPaneResize = function( _w, _h){
                finder.resize( _w, _h - pageHeaderH );
@@ -1858,9 +1866,9 @@ pettanr.premiumSatge = pettanr.view.registerApplication( function(){
                var _data, _artistID = -1;
                
                if( pettanr.driver.isPettanrFileInstance( _ARTISTIDorFILE ) === true ){
-                       if( _ARTISTIDorFILE.getType() === pettanr.driver.FILE_TYPE.ARTIST ){
-                               _data = pettanr.driver._getAPI().getFileData( _ARTISTIDorFILE );
-                               _artistID = _data !== null ? _data.id || 0 : -1;
+                       _data = pettanr.driver._getAPI().getFileData( _ARTISTIDorFILE );
+                       if( _ARTISTIDorFILE.getType() === pettanr.driver.FILE_TYPE.ARTIST || pettanr.driver._getMyPicturesData() === _data ){
+                               _artistID = _data.id || -1;
                        }
                } else
                if( Type.isNumber( _ARTISTIDorFILE ) === true ){