- Timestamp:
- 07/19/12 14:51:21 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.4.2-expresso1/prototype/modules/calendar/js/helpers.js
r6815 r6820 122 122 function eventDetails( objEvent, decoded, path, isMail, repeat) 123 123 { 124 125 $('.qtip.qtip-blue').remove(); 126 124 127 attendees = {}; 125 128 … … 1693 1696 function add_tab_configure_calendar(calendar, type) 1694 1697 { 1698 $('.qtip.qtip-blue').remove(); 1699 1695 1700 var calendars = []; 1696 1701 var signatures = []; … … 2117 2122 $('ul.list-calendars .cal-list-options-btn').on('click',function(){doMenu();}); 2118 2123 2124 2125 /***************************************New Calendar***************************************/ 2119 2126 meu_container.find(".button.new-calendar").button({ 2120 2127 icons: { … … 2123 2130 text: false 2124 2131 }).click(function () { 2125 2126 if( $('.qtip.qtip-blue.qtip-active').val() !== ''){ 2127 $(this).qtip({ 2128 show: { 2129 ready: true, 2130 solo: true, 2131 when: { 2132 event: 'click' 2133 } 2134 }, 2135 hide: false, 2136 content: { 2137 text: $('<div></div>').html( DataLayer.render( 'templates/calendar_quick_add.ejs', {} ) ), 2138 title: { 2139 text:'Nova Agenda', 2140 button: '<a class="button close" href="#">close</a>' 2141 } 2142 }, 2143 style: { 2144 name: 'blue', 2145 tip: { 2146 corner: 'leftMiddle' 2147 }, 2148 border: { 2149 width: 4, 2150 radius: 8 2151 }, 2152 width: { 2153 min: 230, 2154 max:230 2155 } 2156 }, 2157 position: { 2158 corner: { 2159 target: 'rightMiddle', 2160 tooltip: 'leftMiddle' 2161 }, 2162 adjust: { 2163 x:0, 2164 y:-12 2165 } 2166 } 2167 }) 2168 .qtip("api").onShow = function(arg0) { 2169 $('.qtip-active .button.close').button({ 2170 icons: { 2171 primary: "ui-icon-close" 2172 }, 2173 text: false 2174 }) 2175 .click(function(){ 2176 meu_container.find(".button.new-calendar").qtip('destroy'); 2177 }); 2178 //TODO emplementar tratamento de duplicação de valores no location 2179 $('.qtip-active .button.save').button().click(function(){ 2180 for(var i = 0; i < Calendar.calendars.length; i++){ 2181 if(Calendar.calendars[i].location == ( User.me.uid + '/' + $('.qtip-active input').val())){ 2182 $.Zebra_Dialog('O nome desta agenda já está sendo utilizada em uma Url de outra agenda. Por favor, informe outro nome para agenda.',{ 2183 'overlay_opacity': '0.5', 2184 'type': 'warning' 2185 }); 2186 meu_container.find(".button.new").qtip('destroy'); 2187 return; 2188 } 2189 } 2190 2191 var selected; 2192 var color = $('.cal-colors-options-btn').each(function(index){ 2193 if ($(this).is('.color-selected')) 2194 selected = index; 2195 }); 2196 DataLayer.put( "calendarSignature", { 2197 user: User.me.id, 2198 calendar: { 2199 name: Encoder.htmlEncode($('.qtip-active input').val()), 2200 timezone: User.preferences.timezone 2201 }, 2202 isOwner: 1, 2203 fontColor: colorsSuggestions[selected]['font'].substring(1) , 2204 backgroundColor: colorsSuggestions[selected]['background'].substring(1) , 2205 borderColor: colorsSuggestions[selected]['border'].substring(1) 2206 }); 2207 DataLayer.commit( false, false, function( received ){ 2208 delete Calendar.currentViewKey; 2209 Calendar.load(); 2210 refresh_calendars(); 2211 }); 2212 meu_container.find(".button.new").qtip('destroy'); 2213 }); 2214 2215 $('.qtip-active .button.cancel').button().click(function(){ 2216 meu_container.find(".button.new").qtip('destroy'); 2217 }); 2218 2219 $(".qtip-active input").Watermark("Nome da agenda"); 2220 2221 $('.qtip-active').keydown(function(event) { 2222 if (event.keyCode == '27') 2223 meu_container.find(".button.new").qtip('destroy'); 2224 }); 2225 2226 $('.colors-options').prepend(buttons_colors); 2227 $('.colors-options .signed-cal-colors-options-btn-0').addClass('color-selected'); 2228 2229 var buttons = $('.cal-colors-options-btn').button(); 2230 2231 buttons.click(function(){ 2232 buttons.removeClass('color-selected'); 2233 $(this).addClass('color-selected'); 2234 }); 2235 } 2236 } 2132 2133 var typeCalendar = !!parseInt($(this).attr('class').match(/[0-9]+/g)) ? 2134 {type: 'new-group', title: 'Novo Grupo', typeValue: 1, prompt: 'Nome do grupo'} : 2135 {type: 'new-calendar', title: 'Nova Agenda', typeValue: 0, prompt: 'Nome da agenda'} 2136 2137 if(!$('.qtip.qtip-blue.qtip-active.'+typeCalendar.type).length){ 2138 2139 $('.qtip.qtip-blue').remove(); 2140 2141 $(this).qtip({ 2142 show: { 2143 ready: true, 2144 solo: true, 2145 when: { 2146 event: 'click' 2147 } 2148 }, 2149 hide: false, 2150 content: { 2151 text: $('<div></div>').html( DataLayer.render( 'templates/calendar_quick_add.ejs', {} ) ), 2152 title: { 2153 text: typeCalendar.title, 2154 button: '<a class="button close" href="#">close</a>' 2155 } 2156 }, 2157 style: { 2158 name: 'blue', 2159 tip: { 2160 corner: 'leftMiddle' 2161 }, 2162 border: { 2163 width: 4, 2164 radius: 8 2165 }, 2166 width: { 2167 min: 230, 2168 max:230 2169 } 2170 }, 2171 position: { 2172 corner: { 2173 target: 'rightMiddle', 2174 tooltip: 'leftMiddle' 2175 }, 2176 adjust: { 2177 x:0, 2178 y:-12 2179 } 2180 } 2181 }) 2182 .qtip("api").onShow = function(arg0) { 2183 $('.qtip-active .button.close').button({ 2184 icons: { 2185 primary: "ui-icon-close" 2186 }, 2187 text: false 2188 }) 2189 .click(function(){ 2190 meu_container.find('.button.'+typeCalendar.type).qtip('destroy'); 2191 }); 2192 2193 $('.qtip-active').addClass(typeCalendar.type); 2194 2195 $('.qtip-active .button.save').button().click(function(){ 2196 if(!typeCalendar.typeValue) 2197 for(var i = 0; i < Calendar.calendars.length; i++){ 2198 if(Calendar.calendars[i].location == ( User.me.uid + '/' + $('.qtip-active input').val())){ 2199 $.Zebra_Dialog('O nome desta agenda já está sendo utilizada em uma Url de outra agenda. Por favor, informe outro nome para agenda.',{ 2200 'overlay_opacity': '0.5', 2201 'type': 'warning' 2202 }); 2203 $('.qtip.qtip-blue').remove(); 2204 return; 2205 } 2206 } 2207 2208 var selected; 2209 var color = $('.cal-colors-options-btn').each(function(index){ 2210 if ($(this).is('.color-selected')) 2211 selected = index; 2212 }); 2213 DataLayer.put( "calendarSignature", { 2214 user: User.me.id, 2215 calendar: { 2216 name: Encoder.htmlEncode($('.qtip-active input').val()), 2217 timezone: User.preferences.timezone, 2218 type: typeCalendar.typeValue 2219 }, 2220 isOwner: 1, 2221 fontColor: colorsSuggestions[selected]['font'].substring(1) , 2222 backgroundColor: colorsSuggestions[selected]['background'].substring(1) , 2223 borderColor: colorsSuggestions[selected]['border'].substring(1) 2224 }); 2225 DataLayer.commit( false, false, function( received ){ 2226 delete Calendar.currentViewKey; 2227 Calendar.load(); 2228 refresh_calendars(); 2229 }); 2230 $('.qtip.qtip-blue').remove(); 2231 }); 2232 2233 $('.qtip-active .button.cancel').button().click(function(){ 2234 meu_container.find(".button.new").qtip('destroy'); 2235 }); 2236 2237 $(".qtip-active input").Watermark(typeCalendar.prompt); 2238 2239 $('.qtip-active').keydown(function(event) { 2240 if (event.keyCode == '27') 2241 meu_container.find(".button.new").qtip('destroy'); 2242 }); 2243 2244 $('.colors-options').prepend(buttons_colors); 2245 $('.colors-options .signed-cal-colors-options-btn-0').addClass('color-selected'); 2246 2247 var buttons = $('.cal-colors-options-btn').button(); 2248 2249 buttons.click(function(){ 2250 buttons.removeClass('color-selected'); 2251 $(this).addClass('color-selected'); 2252 }); 2253 } 2254 } 2237 2255 }); 2238 2256 2239 2257 $("img.cal-list-img").click(function(evt) { 2240 $(".cal-list-options_1").toggleClass( "hidden" );2258 $(".cal-list-options_1").toggleClass( "hidden" ); 2241 2259 }); 2242 2260 2261 $(".my-groups-task a.title-my-calendars").click(function() { 2262 $(".my-groups-task ul.my-list-calendars").toggleClass("hidden") 2263 $('.my-groups-task .status-list').toggleClass("ui-icon-triangle-1-s"); 2264 $('.my-groups-task .status-list').toggleClass("ui-icon-triangle-1-e"); 2265 }); 2266 2243 2267 $(".my-calendars a.title-my-calendars").click(function() { 2244 $(".my-calendars ul.my-list-calendars").toggleClass("hidden")2245 $('.my-calendars .status-list').toggleClass("ui-icon-triangle-1-s");2246 $('.my-calendars .status-list').toggleClass("ui-icon-triangle-1-e");2268 $(".my-calendars ul.my-list-calendars").toggleClass("hidden") 2269 $('.my-calendars .status-list').toggleClass("ui-icon-triangle-1-s"); 2270 $('.my-calendars .status-list').toggleClass("ui-icon-triangle-1-e"); 2247 2271 }); 2248 2272 2249 2273 $(".signed-calendars a.title-signed-calendars").click(function() { 2250 $(".signed-calendars ul.signed-list-calendars").toggleClass( "hidden");2274 $(".signed-calendars ul.signed-list-calendars").toggleClass( "hidden"); 2251 2275 }); 2252 2276 … … 2530 2554 2531 2555 function pageselectCallback(keyword, page_index, jq, view){ 2556 $('.qtip.qtip-blue').remove(); 2532 2557 2533 2558 var selecteds = getSelectedCalendars(); … … 2609 2634 2610 2635 function show_modal_import_export(tab, calendarId) { 2636 $('.qtip.qtip-blue').remove(); 2611 2637 DataLayer.render( 'templates/import_export.ejs', { 2612 2638 calendars: Calendar.calendars,
Note: See TracChangeset
for help on using the changeset viewer.