

AddCampingConquerorInfoWindow = function(config){
	this.config = config;
	
	this.descriptionTextField = new Ext.form.TextField({
		fieldLabel: '한줄후기',
		name: 'description',
		height:50,
        anchor:'100%',
        allowBlank:false
	});

	this.fileUploadField =  new Ext.form.FileUploadField({
		emptyText: '(선택사항) 내가 찍은 '+this.config.camping_name+' 한컷 등록',
	    fieldLabel: '정복기념샷',
	    name: 'file',
	    width:342,
      y: 140,
	    buttonCfg: {
		    text: '',
		    iconCls: 'upload-icon'
	    }			
	});



	this.formPanel = new Ext.form.FormPanel({
    width: 394,
    height: 280,
    padding: 10,
        keys: [{
        	key: Ext.EventObject.ENTER,
        	scope:this,
        	fn: this.submit
     	}],
    frame: true,
    layout: 'absolute',
    scope:this,
    fileUpload: true,
     	items: [{
                xtype: 'label',
                text: '',
                width: 330,
                x: 10,
                y: 10,
                html: this.config.camping_name+'을(를) 내가 정복한 캠핑장으로 마크합니다.  정복 기념으로 다른 캠지 캠퍼들을 위해 한줄 평 부탁드립니다.^^<br><br>(작성된 한줄 평은 내년도 캠핑지도 500 책자에 실릴수 있습니다.)'
            },
            {
                xtype: 'textarea',
                name: 'description',
                anchor: '100%',
                x: 10,
                y: 80
            },
            
            this.fileUploadField]
     	
        
    });
	
	
	
	AddCampingConquerorInfoWindow.superclass.constructor.call(this, {
		title: '나의 정복지 등록하기',
		id:'AddCampingConquerorInfoWindowID',
		closable:true,
		iconCls:'add',
        width: 400,
        height:280,
        minWidth: 400,
        minHeight: 280,
        layout: 'fit',
        resizeable:false,
        plain:true,
        modal:true,
        bodyStyle:'padding:5px;',
        buttonAlign:'right',
        items: this.formPanel,
        //closeAction: this.cancel,
        buttons: [
        {
            text: '정복지 등록',
            type:'submit',
            scope:this,
            handler: this.submit
        },{
            text: '취소',
            type:'cancel',
            scope:this,
            handler: this.cancel
        }]
	});
	
};

Ext.extend(AddCampingConquerorInfoWindow, Ext.Window, {


	submit : function(){
		//var loginWindow = Ext.getCmp('loginWindow');
		if(this.formPanel.getForm().isValid()){
			this.formPanel.form.submit(
			{	waitMsg: '항목 등록 중...',
				url:'./src/api/Interface.php',
				params :{
							'class':'Camping',
							method:'setConquerorInfo',
							'camping_list_uid':this.config.camping_list_uid
						},
				scope:this,
				success: function(form, action) {
					if(action.result.success){
						this.formPanel.getForm().reset();
						this.close();
						//location.reload();
					}else{
            Ext.MessageBox.alert('정복지 등록 오류', '1')
          }
				},
				failure: function(form, action) { 
					Ext.MessageBox.alert('정복지 등록 오류', '2')
				}
			});
            		//loginWindow.close();
		}
		//this.close();
		
	},
	
	cancel : function(){
	  
		this.close();
	}
	





});

