OSDN Git Service

client is version0.4.12, bugfix UI, update PanelConsole.
authoritozyun <itozyun@gmail.com>
Sun, 2 Sep 2012 08:45:15 +0000 (17:45 +0900)
committeritozyun <itozyun@gmail.com>
Sun, 2 Sep 2012 08:45:15 +0000 (17:45 +0900)
app/assets/javascripts/peta.apps.js
app/assets/javascripts/system.js
app/assets/stylesheets/peta.apps.css

index 981f6a4..d8833a4 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * pettanR peta.apps.js
- *   version 0.5.11
+ *   version 0.5.12
  *   
  * author:
  *   itozyun
                                                        };
                                                };
                                        };
-                                       addChildData( _data.author_id === MyAuthorID ? FILE_DATA_MY_PANELS_ROOT : FILE_DATA_LATEST_PANELS, _data );
+                                       _data.publish === 1 && addChildData( FILE_DATA_LATEST_PANELS, _data );
+                                       _data.author_id === MyAuthorID && addChildData( FILE_DATA_MY_PANELS_ROOT, _data );
                                } else
                                // Picture
                                if( _data.type == FILE_TYPE.PICTURE ){
                                        return [ _data.id, _data.ext ].join( '.' );
                                } else
                                if( _type === FILE_TYPE.PANEL ){
-                                       return [ _data.t, ':', _data.comic ? _data.comic.title : 'free panel' ].join( '' );
+                                       return [ 'id:' + _data.id + ', ' + ( _data.t || '' ) + ':', _data.comic ? _data.comic.title : 'no comic' ].join( '' );
                                } else
                                if( _type === FILE_TYPE.COMIC ){
                                        return _data.title;
@@ -1536,17 +1537,16 @@ var Editor = gOS.registerApplication( function(){
                        Editor.shutdown();
                };
                function onSave(){
-                       var model = Model.createPanel( {
+                       PanelConsole.boot( Model.createPanel( {
                                comicID           : comicID,
                                panelID           : panelID,
                                panelTimming      : panelTimming,
                                panelW            : PANEL_CONTROL.w,
                                panelH            : PANEL_CONTROL.h,
                                borderSize        : 2,
-                               panelElementArray : PANEL_ELEMENT_ARRAY
-                       } );
-                       PanelConsole.boot( model.getJsonPostString().replace( /\n/g, '' ) );
-                       model.destroy();
+                               panelElementArray : PANEL_ELEMENT_ARRAY,
+                               publish           : true
+                       } ) );
                };
                function onSaveQuit(){
                        // Editor.shutdown();
@@ -4220,7 +4220,7 @@ var ComicConsole = gOS.registerApplication( function(){
                                        elmIframe.onload = null;
                                        try {
                                                console.log( ( elmIframe.contentWindow || elmIframe.contentDocument.parentWindow ).document.body.innerHTML );
-                                               console.log( ( elmIframe.contentWindow || elmIframe.contentDocument.parentWindow[ '' ] ) )
+                                               console.log( ( elmIframe.contentWindow || elmIframe.contentDocument.parentWindow[ 'current_author' ] ) )
                                        } catch(e){
                                                
                                        }
@@ -4650,13 +4650,14 @@ var ArtistConsole = gOS.registerApplication( function(){
 var Model = ( function(){
        
        var PanelModelClass = function( panel ){
-               var comicID           = panel.comicID,
-                       panelID           = panel.panelID,
-                       panelTimming      = panel.panelTimming,
+               var comicID           = panel.comicID || -1,
+                       panelID           = panel.panelID || -1,
+                       panelTimming      = panel.panelTimming || -1,
                        panelW            = panel.panelW,
                        panelH            = panel.panelH,
                        borderSize        = panel.borderSize,
                        panelElementArray = panel.panelElementArray,
+                       publish           = panel.publish,
                        timing            = 0;
                        
                function getPanelElementByTiming(){
@@ -4794,24 +4795,24 @@ var Model = ( function(){
                        };
                        return [
                                '{', cr,
-                                       //'"panel": {', cr,
-                                               //'"id": ',               panelID, ',', cr,
-                                           '"width": ',            panelW, ',', cr,
-                                           '"height": ',           panelH, ',', cr,
-                                           '"border": ',           borderSize, ',', cr,
-                                           // '"comic_id": ',         comicID, ',', cr,
-                                           // '"picture_id": 1,', cr,
-                                               '"x": ',                0, ',', cr,
-                                               '"y": ',                0, ',', cr,
-                                               '"z": ',                1, ',', cr,
-                                               // '"t": ',                             panelTimming, ',', cr,
-                                           '"panel_pictures_attributes": {', cr,
-                                               IMAGE_ARRAY.join( ',' + cr ), cr,
-                                           '},', cr,
-                                           '"speech_balloons_attributes": {', cr,
-                                               BALLOON_ARRAY.join( ',' + cr ), cr,
-                                           '}', cr,
-                                       //'}', cr,
+                                       panelID !== -1 ? ( '"id": ' + panelID + ',' + cr ) : '',
+                                       comicID !== -1 ? ( '"comic_id": ' + comicID + ',' + cr ) : '',
+                                   '"width": ',            panelW, ',', cr,
+                                   '"height": ',           panelH, ',', cr,
+                                   '"border": ',           borderSize, ',', cr,
+                                   
+                                   // '"picture_id": 1,', cr,
+                                       '"x": ',                0, ',', cr,
+                                       '"y": ',                0, ',', cr,
+                                       '"z": ',                1, ',', cr,
+                                       panelTimming !== -1 ? ( '"t": ' + panelTimming + ',' + cr ) : '',
+                                   '"panel_pictures_attributes": {', cr,
+                                       IMAGE_ARRAY.join( ',' + cr ), cr,
+                                   '},', cr,
+                                   '"speech_balloons_attributes": {', cr,
+                                       BALLOON_ARRAY.join( ',' + cr ), cr,
+                                   '}', ',', cr,
+                                   '"publish": ',           ( publish === true ? 1 : 0 ), cr,
                                '}'
                        ].join( '' );
                };
@@ -4877,6 +4878,9 @@ var Model = ( function(){
                        
                        return HTML_ARRAY.join( pettanr.LINE_FEED_CODE_TEXTAREA );
                };
+               this.publish = function( v ){
+                       return publish = Type.isBoolean( v ) === true ? v : publish;
+               };
                this.destroy = function(){
                        panel = panelElementArray = null;
                };
@@ -4980,7 +4984,8 @@ var OutputConsole = gOS.registerApplication( function(){
                        panelW            : _panelW,
                        panelH            : _panelH,
                        borderSize        : _borderSize,
-                       panelElementArray : _panelElementArray
+                       panelElementArray : _panelElementArray,
+                       publish           : true
                } );
                
                formatUpdate();
@@ -5004,13 +5009,15 @@ var OutputConsole = gOS.registerApplication( function(){
 var PanelConsole = gOS.registerApplication( function(){
        var windowW, windowH,
                TARGET_FRAME_NAME = 'targetFrameCreateNewPanel',
-               elmContainer, elmProgress,
-               elmScript = null,
-               elmForm = null,
-               elmIframe = null,
+               comboboxPublish, buttonPost, buttonClose,
+               elmContainer, elmProgress, elmInput,
+               elmScript   = null,
+               elmForm     = null,
+               elmIframe   = null,
                isUploading = false,
-               instance = this,
-               json;
+               instance    = this,
+               model       = null;
+               
        /*
         * upload ボタンが押されたらまず iframe をつくる.
         */
@@ -5074,8 +5081,9 @@ var PanelConsole = gOS.registerApplication( function(){
                                if( _input.type === 'submit' ){
                                        _input.style.display = 'none';
                                };
-                               if( _input.name === 'json' && Type.isString( json ) === true ){
-                                       _input.value = json;
+                               if( _input.name === 'json' ){
+                                       elmInput     = _input;
+                                       publishUpdate();
                                };
                        };
                        instance.removeTimer( detectForm );
@@ -5091,10 +5099,16 @@ var PanelConsole = gOS.registerApplication( function(){
                instance.onPaneResize( windowW, windowH );
        };
        function clickCancel(){
-               if( isUploading === true) return false;
+               if( isUploading === true ) return false;
                PanelConsole.shutdown();
                return false;
        };
+       function publishUpdate(){
+               if( model ){
+                       model.publish( comboboxPublish.selectIndex() === 1 );
+                       elmInput.value = model.getJsonPostString().replace( /\n/g, '' );                        
+               };
+       };
 
        /* grobal method */
        this.MIN_WIDTH   = 320;
@@ -5106,6 +5120,10 @@ var PanelConsole = gOS.registerApplication( function(){
                        '<div id="panel-console-header" class="console-header">Create New Panel (dev)</div>',
                        '<div id="panel-console" class="console-inner">',
                                '<div id="newpanel"></div>',
+                               '<div id="panel-console-publish" class="field">',
+                                       '<span class="field-label">Publish:</span>',
+                                       '<span id="panel-console-publish-value" class="combobox"></span>',
+                               '</div>',
                                '<div class="console-button-container">',
                                        '<div id="panel-console-post-button" class="button console-submit-button">post</div>',
                                        '<div id="panel-console-cancel-button" class="button console-cancel-button">cancel</div>',
@@ -5118,12 +5136,26 @@ var PanelConsole = gOS.registerApplication( function(){
 
                delete instance.onInit;
        }
-       this.onOpen = function( w, h, _json ){
+       this.onOpen = function( w, h, _model ){
+               var ui           = instance.createUIGroup();
+               // inputTitle       = ui.createInputText( document.getElementById( 'comic-console-title') );
+               
+               if( _model ){
+                       comboboxPublish  = ui.createCombobox( document.getElementById( 'panel-console-publish'), publishUpdate );
+                       comboboxPublish.createOption( 'only me', '0', _model.publish() === false );
+                       comboboxPublish.createOption( 'publish', '1', _model.publish() === true );
+                       model = _model;
+               } else {
+                       var elm = document.getElementById( 'panel-console-publish');
+                       elm.parentNode.removeChild( elm );
+               };
+               
+               buttonPost       = ui.createButton( document.getElementById( 'panel-console-post-button' ), clickOK );
+               buttonClose      = ui.createButton( document.getElementById( 'panel-console-cancel-button' ), clickCancel );
+               
                elmContainer = document.getElementById( 'newpanel' );
                elmProgress  = document.getElementById( 'panel-console-progress' );
-               
-               instance.addMouseEventListener( document.getElementById( 'panel-console-post-button' ), 'click', clickOK );
-               instance.addMouseEventListener( document.getElementById( 'panel-console-cancel-button' ), 'click', clickCancel );
+
                /*
                 * ie 6, 7 で fadeIn 中の要素に appendChild すると クラッシュするので、document.body に追加.
                 */                             
@@ -5135,8 +5167,6 @@ var PanelConsole = gOS.registerApplication( function(){
                instance.addTimer( detectForm, 250 );
                instance.onPaneResize( w, h );
                
-               json = _json;
-               
                elmProgress.innerHTML = 'loading form.';
        };
        this.onPaneResize = function( _windowW, _windowH ){
@@ -5148,7 +5178,9 @@ var PanelConsole = gOS.registerApplication( function(){
                ].join( '' );
        };
        this.onClose = function(){
-               elmHeader = elmProgress = elmForm  = elmUploader = instance = null;
+               model && model.destroy();
+               elmHeader = elmProgress = elmForm  = elmUploader = instance = model = null;
+               comboboxPublish = buttonPost = buttonClose = null;
                isUploading = false;
        };
 }, true, true, 'Panel Console', 'panelConsole', null, '#603CBA' );
index c7f4a12..a99117d 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * pettanR system.js\r
- *   version 0.5.11\r
+ *   version 0.5.12\r
  * \r
  * \r
  * Type\r
@@ -3461,6 +3461,7 @@ var UI = ( function(){
                                elmValue.removeChild( ELM_INPUT_TEXT );\r
                        }\r
                        MouseEvent.remove( apiuser, elmWrapper );\r
+                       \r
                        apiuser = uiGroup = elmWrapper = elmValue = elmA = onUpdate = validater = instance = null;\r
                };\r
                instance.value( value );\r
@@ -3630,13 +3631,14 @@ var UI = ( function(){
                                        break;\r
                                };\r
                        };\r
+                       if( _isSelected === true ){\r
+                               index = optionList.length;\r
+                               elmValue.data = _displayValue;\r
+                       };                      \r
                        if( option === null ){\r
                                option = new OptionClass( _displayValue, _value, _isSelected );\r
                                optionList.push( option );\r
                        };\r
-                       if( _isSelected === true ){\r
-                               elmValue.data = _displayValue;\r
-                       };\r
                };\r
                this.destroy = function(){\r
                        instance.blur();\r
@@ -3875,7 +3877,10 @@ var UI = ( function(){
                        var _item;\r
                        while( _item = itemList.shift() ){\r
                                _item.destroy();\r
-                       }\r
+                               if( currentItem === _item ){\r
+                                       currentItem = null;\r
+                               };\r
+                       };\r
                };\r
        };\r
        \r
index 7e2b16c..9120ed1 100644 (file)
@@ -1,7 +1,7 @@
 @charset "UTF-8";\r
 \r
 /* pettanR peta.apps.css\r
- *   version 0.5.5\r
+ *   version 0.5.12\r
  * \r
  *   author:\r
  *     itozyun\r
                                                        width:                  180px;\r
                                                        text-align:             center;\r
                                                }\r
+\r
+               /*  Panel Console\r
+               --------------------------------------------------------------------------------------*/                        \r
+               #panel-console-publish-value {\r
+                                                       width:                  180px;\r
+                                                       text-align:             center; \r
+               }\r
+                                               \r
                /*  Comic Reader\r
                --------------------------------------------------------------------------------------*/\r
                #comic-reader-wrapper {}\r
                                }\r
                                .pettanr-ActiveX-enabled .comic-reader-shadow {\r
                                        filter:                         alpha(opacity=50);\r
-                                       -ms-filter:                     alpha(opacity=50);                      \r
+                                       -ms-filter:                     "alpha(opacity=50)";\r
                                }\r
                                .pettanr-ActiveX-disabled .comic-reader-shadow {\r
                                        background:                     transparent url( "/assets/black_50pct.png" ) repeat 0 0;\r