/*!
 * Ext JS Library 3.2.1
 * Copyright(c) 2006-2010 Ext JS, Inc.
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.onReady(function(){
    var xd = Ext.data;

    var store = new Ext.data.JsonStore({
        proxy: new Ext.data.HttpProxy({
            url: 'JsonDondur.aspx?pSecim=7'
        }),
        root: 'dersnotlari',
        totalProperty: 'toplamKayit',
        idProperty: 'notId',
        remoteSort: true,
        fields: [
        'notBaslik', 
        'notAdres1', 
        'notAdres2',
        'notId',
        'icerik']	
    });
    store.load();

    var tpl = new Ext.XTemplate(
		'<tpl for=".">',	
			'<div class="thumb-wrap" id="{notId}">',
		    	'<div class="thumb"><img src="resimLer/not{notId}.gif" title="{name}"></div>',
		    	'<span id="spnBaslik" style="font-weight:bold;">{notBaslik}</span>',
		    	'<span id="spnnotAdres1"><a href="{notAdres1}" target="_blank">Indir</a></span>',
		    	'<span id="spnnotAdres2"><a href="{notAdres2}" target="_blank">Indir(Alternatif)</a></span><br />',
		    	'<span id="spnIcerik">{icerik}</span>',
		    '</div>',
		'</tpl>'
	);
		    var panel = new Ext.Panel({
        id:'images-view',
        frame:true,
        width:535,
        //autoHeight:true,
        collapsible:false,
        layout:'fit',
        title:'Ders Notlari',		
        items: new Ext.DataView({
            store: store,
            tpl: tpl,
            autoHeight:true,
            // singleSelect: true, bunlar true olursa onclick durduruluyor. (a href ler calismiyor.)
            // multiSelect: true,
            overClass:'x-view-over',
            itemSelector:'div.thumb-wrap',
            // emptyText: 'No images to display',
            prepareData: function(data){
            	data.icerik = tumunuDegistir(data.icerik, '#', '<br />') ;
                return data ;
            },
            listeners: {
		    	selectionchange: {
		    		fn: function(dv, nodes){
		    			// bosver.
		    		}
		    	}
		    }
        })
    });
    
	

	/*	
	var panel = new Ext.Panel({
        id:'view',
        frame:true,
        width:535,
        collapsible:true,
        layout:'fit',
        title:'Simple DataView (0 items selected)',
    	items: new Ext.DataView({
            store: store,
            id: 'imageView',
            layout: 'fit',
            tpl: tpl,
            autoHeight:true,
            multiSelect: true,
            overClass:'over',
            itemSelector:'img.image',
            selectedClass: 'selected',
            singleSelect: true
        })
	});
	*/
    // panel.render(document.body);
    
    var _viewport = new Ext.Viewport({
        layout: 'fit',
        items: panel,
        renderTo: Ext.getBody()
    });
      
});
