- Timestamp:
- 06/14/12 01:17:45 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/expressoServiceImap/expressoMail1_2/js/draw_api.js
r6469 r6486 3829 3829 autoOpen:false 3830 3830 }); 3831 3832 3831 3833 3832 jQuery.getScript("../prototype/modules/attach_message/attach_message.js", function(){ 3834 3833 jQuery('#message-attach-dialog').dialog('open'); … … 3879 3878 jQuery('#message-attach-dialog').dialog('close'); 3880 3879 }); 3881 }); 3880 }).fail(function( jqxhr, settings, exception ){ 3881 3882 alert( exception ); 3883 console.log( exception ); 3884 3885 }) 3882 3886 }); 3887 3888 DataLayer.codec( 'folder', 'tree', { 3889 3890 encoder: function( data ){ 3891 3892 if( preferences.use_local_messages == 1 || expresso_offline) 3893 { 3894 var folders = expresso_local_messages.list_local_folders(); 3895 3896 var stripParents = /^(.*)\/([^\/]*)/; 3897 3898 $.each( folders, function( i, folder ){ 3899 3900 if(typeof(folder) == 'undefined') return; 3901 3902 var id = 'local_messages/' + folder[0]; 3903 3904 var parts = stripParents.exec( id ); 3905 3906 data[data.length] = { 'id' : id, 3907 'commonName' : parts[2], 3908 'parentFolder' : parts[1] }; 3909 }); 3910 } 3911 3912 var trees = [[],[],[]], 3913 3914 root = { inbox: /^INBOX/, share: /^user/, local: /^local_messages/ }; 3915 3916 for (var i = 0; i < data.length; i++ ) 3917 { 3918 var index = root.inbox.test(data[i].id) ? 0 : 3919 root.share.test(data[i].id) ? 1 : 3920 root.local.test(data[i].id) ? 2 : 3921 'false'; 3922 3923 if( isNaN(index) ) continue; 3924 3925 if (!unorphanize(trees[index], data[i])) 3926 { 3927 data[i].children = []; 3928 trees[index].push(data[i]); 3929 } 3930 } 3931 3932 return( { folders: trees } ); 3933 } 3934 } ); 3935 3936 current_folder = 'INBOX'; 3937 3938 DataLayer.codec( 'message', 'jqGrid', { 3939 3940 encoder: function( data, crit ){ 3941 3942 if( !crit.criteria.properties.context.folder.indexOf( 'local_messages/' ) ) 3943 { 3944 var msgs = expresso_local_messages.get_local_range_msgs( crit.criteria.properties.context.folder.replace(dots, "/").replace("local_messages/", ""), 3945 crit.offset + 1, crit.limit, "SORTARRIVAL", crit.orderDesc, "ALL", 1, 1 ); 3946 3947 for( var i = 0; i < msgs.length; i++ ) 3948 { 3949 msgs[i].size = msgs[i].Size; 3950 msgs[i].timestamp = msgs[i].udate * 1000; 3951 msgs[i].flags = []; 3952 3953 for( var ii = 0; ii < flags.length; ii++ ) 3954 if( f = $.trim( msgs[i][ flags[ii] ] ) ) 3955 msgs[i].flags[ msgs[i].flags.length ] = f; 3956 3957 msgs[i].flags = msgs[i].flags.join(','); 3958 } 3959 3960 return( {"rows": msgs, 3961 "records": msgs.length, 3962 "page": crit.page, 3963 "total": Math.ceil( msgs.num_msgs / crit.limit )} ); 3964 } 3965 3966 return( data ); 3967 }, 3968 criteria: function( crit ){ 3969 3970 return { criteria: { properties: {context:{folder: current_folder || 'INBOX'}}, offset: crit.rows * ( crit.page - 1 ), limit: crit.rows, orderDesc: crit.sord == "desc" } }; 3971 3972 } 3973 }); 3974 3883 3975 return ID; 3884 3976 }
Note: See TracChangeset
for help on using the changeset viewer.