Changeset 5554 for trunk/prototype/modules/mail
- Timestamp:
- 02/27/12 10:07:00 (13 years ago)
- Location:
- trunk/prototype/modules/mail/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/modules/mail/js/followupflag.js
r5548 r5554 350 350 351 351 .filter('.menu-configure-followupflag .delete').click(function(){ 352 352 353 for(i = 0; i < selectedMessageIds.length; i++){ 353 354 var folder_name; … … 372 373 DataLayer.commit(); 373 374 winElement.dialog("close"); 375 374 376 }); 375 377 -
trunk/prototype/modules/mail/js/label.js
r5547 r5554 29 29 $(span).html($(".label-list").find(".edit-value-list").val()) 30 30 .parent().find('.edit').removeClass("hidden").parents("li").click(configureLabel).trigger("click"); 31 winElement.find(".buttons .save-label").click(save_editLabel()); 31 32 winElement.find(".buttons .save-label").trigger("click"); 33 32 34 }else if( event.keyCode == 27){ 33 35 $(this).trigger("focusout"); … … 44 46 event.stopImmediatePropagation(); 45 47 } 46 function colors_suggestions(){ 47 return [ 48 {name:'Padrão', border:'#3366cc', font:'#ffffff', background:'#3366cc'}, 49 {name:'Coala', border:'#123456', font:'#ffffff', background:'#385c80'}, 50 {name:'Tomate', border:'#d5130b', font:'#111111', background:'#e36d76'}, 51 {name:'Limão', border:'#32ed21', font:'#1f3f1c', background:'#b2f1ac'}, 52 {name:'Alto contraste', border:'#000000', font:'#ffffff', background:'#222222'} 53 ] 54 } 55 function rgb2hex(rgb){ 56 rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 57 return "#" + 58 ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) + 59 ("0" + parseInt(rgb[2],10).toString(16)).slice(-2) + 60 ("0" + parseInt(rgb[3],10).toString(16)).slice(-2); 61 } 62 63 function confirmDelete(id){ 64 $.Zebra_Dialog('<strong>Deseja excluir esse marcador?</strong>', { 65 'type': 'question', 66 'title': 'Atenção', 67 'buttons': ['Sim','Não'], 68 'onClose': function(caption) { 69 if(caption == 'Sim'){ 70 delete_label(id); 71 } 72 } 73 }); 74 } 75 function delete_label(id){ 76 $(".label-list li").each(function () { 77 var regex_match = $(this).attr("class").match(/label-item-([\d]+[()a-zA-Z]*)/); 78 if (regex_match && regex_match[1] && regex_match[1] == id) { 79 $(this).remove(); 80 } 81 }); 82 DataLayer.remove('label', id); 83 DataLayer.commit(); 84 winElement.find(".label-list li:first").trigger("click"); 85 86 if($(".label-list li").length == 0){ 87 winElement.find(".label-list-container").html('<ul class="label-list"><li class="empty-item">Nenhum Marcador Cadastrado.</li></ul>'); 88 } 89 var qtdLi = $(".label-list-container ul").find("li").not(".empty-item").length; 90 if (qtdLi == 0){ 91 $(".my-labels").addClass("hidden"); 92 $(".label-list-container ul").find(".empty-item").css("display",""); 93 winElement.find(".buttons .save-label .ui-button-text").text('Criar'); 94 $(".delete-label").button("disable"); 95 96 winElement.find('.input-nome').val(""); 97 winElement.find(".preview-label-inner").text(""); 98 99 var colorpicker = winElement.find('.lebals-colorpicker'); 100 colorpicker.find('input[name="backgroundColor"]').val("#ebebeb") 101 .css("background-color", "#ebebeb").focus().end() 102 .find('input[name="fontColor"]').val("#000000").css("background-color", "#000000").focus().end() 103 .find('input[name="borderColor"]').val("#000000").css("background-color", "#000000").focus().end() 104 .find('.preview-label-outer').css({ 105 'background-color':"#ebebeb", 106 'color':"#000000", 107 'border-color':"#000000" 108 }); 109 $(".input-nome").keyup(function () { 110 var value = $(this).val(); 111 winElement.find('.preview-label-inner').text(value); 112 }).keyup(); 113 } 114 } 115 function new_label(nameLabel, isNew){ 116 var labelCreated = { 117 uid: User.me.id, 118 name : nameLabel, 119 backgroundColor : !!isNew ? '#ebebeb' : winElement.find("input[name='backgroundColor']").val(), 120 fontColor : !!isNew ? '#000000' : winElement.find("input[name='fontColor']").val(), 121 borderColor :!!isNew ? '#000000' : winElement.find("input[name='borderColor']").val() 122 } 123 DataLayer.put('label', labelCreated); 124 125 $(".add-label-button").removeClass("ui-icon ui-icon-plus") 126 .html('<img alt="Carregando" title="Carregando" style="margin-left:10px;" src="../prototype/modules/mail/img/loader.gif" />'); 127 128 DataLayer.commit(false, false, function(){ 129 130 labels = DataLayer.get('label',{criteria:{order: 'id'}}, true); 131 newLabel = { 132 id: labels[labels.length - 1].id, 133 name : labels[labels.length- 1].name, 134 uid: User.me.id, 135 bgColor : !!isNew ? '#ebebeb' : winElement.find("input[name='backgroundColor']").val(), 136 fontColor : !!isNew ? '#000000' : winElement.find("input[name='fontColor']").val(), 137 borderColor : !!isNew ? '#000000' : winElement.find("input[name='borderColor']").val() 138 }; 139 140 $(".label-list-container ul").find(".empty-item").css("display","none"); 141 $(".label-list-container ul") 142 .prepend(DataLayer.render("../prototype/modules/mail/templates/label_listitem.ejs", newLabel)) 143 .find("li:first") 144 .fadeIn("slow").click(configureLabel); 145 146 $("#MyMarckersList") 147 .html( 148 "<div class='my-labels'>" + 149 "<img src='../prototype/modules/mail/img/tag.png'/>" + 150 "<a class='title-my-labels' tabindex='0' role='button' aria-expanded='false' title='Meus marcadores'>Meus marcadores</a>" + 151 152 "<span class='status-list-labels ui-icon ui-icon-triangle-1-s'></span>" + 153 "</div>" 154 ) 155 .append(DataLayer.render("../prototype/modules/mail/templates/label_list.ejs", {labels:DataLayer.get('label', true)} )) 156 .find("li.label-item").css({"background-color":"#ffffff", "border-color":"#CCCCCC", "color":"#444444"}) 157 .find(".square-color").css("display","").click(function(){ 158 $(this).parent(".label-item").each(function(){ 159 configureLabels({selectedItem: $(this).attr('class').match(/label-item-([\d]+[()a-zA-Z]*)/)[1]}); 160 }); 161 }); 162 $("#MyMarckersList a.title-my-labels").click(function() { 163 $("#MyMarckersList ul.label-list").toggleClass("hidden") 164 $('#MyMarckersList .status-list-labels').toggleClass("ui-icon-triangle-1-s"); 165 $('#MyMarckersList .status-list-labels').toggleClass("ui-icon-triangle-1-n"); 166 }); 167 168 $(".label-list-container .label-list li").not(".empty-item").click(function(){ 169 $(".label-list-container .label-list li").find("img").remove(); 170 $(".label-list-container .label-list li.label-item").removeClass("selected"); 171 $(this).prepend("<img src='../prototype/modules/mail/img/triangle.png' style='margin: 0 5px 0 -5px;'>"); 172 $(this).addClass("selected"); 173 }); 174 175 $(".label-list-container .label-list li").find('.button').button() 176 .filter('.edit').button({icons:{primary:'ui-icon-pencil'}, text:false}).end() 177 .filter('.close').button({icons:{primary:'ui-icon-close'}, text:false}); 178 179 //posiciona para edição o label inserido 180 winElement.find("ul.label-list li:first").trigger("click"); 181 winElement.find(".buttons .save-label .ui-button-text").text('Salvar'); 182 $(".delete-label").button("enable"); 183 184 winElement.find('.edit').unbind("click").click(editLabel); 185 winElement.find('.close').click(deleteLabel); 186 187 $(".my-labels").removeClass("hidden"); 188 189 $.contextMenu( 'destroy', ".table_box tbody tr"); 190 loadMenu(); 191 192 $(".add-label-button").empty() 193 .addClass("ui-icon ui-icon-plus"); 194 }); 195 196 } 197 function init_label(data){ 198 199 winElement = data.window; 200 201 //TODO Mudar quando API abstrair atualizações no cache 202 DataLayer.remove('label',false); 203 labels = DataLayer.get('label',{criteria:{order: 'name'}}); 204 205 if(labels){ 206 Label_List = winElement 207 .find(".label-list-container").html(DataLayer.render("../prototype/modules/mail/templates/label_list.ejs", {labels: labels})); 208 209 }else{ 210 //Exibe a mensagem informando o usuário de que não há nenhum marcador cadastrado. 211 Label_List = winElement 212 .find(".label-list-container").html('<ul class="label-list"><li class="empty-item">Nenhum Marcador Cadastrado.</li></ul>'); 213 214 } 215 Label_List.end() 216 .find('.button').button() 217 .filter('.edit').button({icons:{primary:'ui-icon-pencil'}, text:false}).end() 218 .filter('.close').button({icons:{primary:'ui-icon-close'}, text:false}); 219 220 winElement.find('.edit').click(editLabel); 221 winElement.find('.close').click(deleteLabel); 222 223 //marca 'd agua 224 winElement.find(".insert-label").Watermark(winElement.find(".insert-label").val()); 225 226 $("input.insert-label").keyup(function () { 227 $.Watermark.HideAll(); 228 var value = $(this).val(); 229 winElement.find('.input-nome').val(value); 230 }).keyup(); 231 232 if (!(labels)){ 233 winElement.find(".buttons .save-label .ui-button-text").text('Criar'); 234 $(".delete-label").button("disable"); 235 }else{ 236 winElement.find(".label-list li:first").addClass("selected").prepend("<img src='../prototype/modules/mail/img/triangle.png' style='margin: 0 5px 0 -5px;'>"); 237 } 238 $(".save-label").button("disable"); 239 /** 240 * seta a ação de click para os marcadores listados na tela 241 */ 242 winElement.find(".label-list li").not(".empty-item").click(configureLabel); 243 244 if (data.selectedItem) 245 winElement.find(".label-list li.label-item-"+data.selectedItem).trigger("click"); 246 else 247 winElement.find(".label-list li:first").trigger("click"); 248 249 var dataColorPicker = { 250 colorsSuggestions: colors_suggestions() 251 }; 252 253 winElement.find('select.color-suggestions').change(function() { 254 $(".save-label").button("enable"); 255 var colorpicker = winElement.find('.lebals-colorpicker'); 256 var colors; 257 if(colors = dataColorPicker.colorsSuggestions[$(this).val()]) { 258 colorpicker 259 .find('input[name="fontColor"]').val(colors.font).focus().end() 260 .find('input[name="backgroundColor"]').val(colors.background).focus().end() 261 .find('input[name="borderColor"]').val(colors.border).focus().end() 262 263 .find('.preview-label-outer').css({ 264 'background-color':dataColorPicker.colorsSuggestions[$(this).val()].background, 265 'border-color':dataColorPicker.colorsSuggestions[$(this).val()].border, 266 'color':dataColorPicker.colorsSuggestions[$(this).val()].font 267 }); 268 } 269 }); 270 var colorpickerPreviewChange = function(color) { 271 272 var pickedup = winElement.find('.colorwell-selected').val(color).css('background-color', color); 273 274 $(".save-label").button("enable"); 275 276 var colorpicker = winElement.find('.lebals-colorpicker'); 277 278 if (pickedup.is('input[name="backgroundColor"]')) { 279 colorpicker.find('.preview-label-outer').css('background-color',color); 280 } else if (pickedup.is('input[name="fontColor"]')) { 281 colorpicker.find('.preview-label-outer').css('color',color); 282 } else if (pickedup.is('input[name="borderColor"]')) { 283 colorpicker.find('.preview-label-outer').css('border-color',color); 284 } 285 } 286 287 var f = $.farbtastic(winElement.find('.colorpicker'), colorpickerPreviewChange); 288 var selected; 289 290 winElement.find('.colorwell').each(function () { 291 f.linkTo(this); 292 }) 293 .focus(function() { 294 if (selected) { 295 $(selected).removeClass('colorwell-selected'); 296 } 297 $(selected = this).addClass('colorwell-selected'); 298 f.linkTo(this, colorpickerPreviewChange); 299 f.linkTo(colorpickerPreviewChange); 300 }); 301 302 winElement.find(".add-label-button").click(function (event) { 303 $.Watermark.HideAll(); 304 var nameLabel = winElement.find(".insert-label").val(); 305 if(nameLabel.length >= 2){ 306 new_label(nameLabel, true); 307 $.Watermark.ShowAll(); 308 winElement.find(".insert-label").val(""); 309 } else { 310 alert("Mínimo 2 caracteres"); 311 } 312 event.stopImmediatePropagation(); 313 }); 314 315 winElement.find('.insert-label').keydown(function(event, ui) { 316 if (event.keyCode == 13) 317 winElement.find(".add-label-button").trigger('click'); 318 }); 319 320 //excluir marcador {deve ser para o botão grande na janela de edição e nao o pequeno da lista} 321 winElement.find(".buttons .delete-label").click(function(event){ 322 var id = winElement.find(".edit-label").val(); 323 confirmDelete(id); 324 event.stopImmediatePropagation(); 325 }); 326 327 $(".label-list-container .label-list li").not(".empty-item").click(function(){ 328 $(".label-list-container .label-list li").find("img").remove(); 329 $(".label-list-container .label-list li.label-item").removeClass("selected"); 330 $(this).prepend("<img src='../prototype/modules/mail/img/triangle.png' style='margin: 0 5px 0 -5px;'>"); 331 $(this).addClass("selected"); 332 }); 333 334 //salvar/criar marcador 335 winElement.find(".buttons .save-label").click(function(){ 48 function save_editLabel(){ 336 49 $(".save-label").button("disable"); 337 50 var labelEdited = { … … 420 133 421 134 $(".label-list-container .label-list").find(".label-item-"+labelEdited.id).trigger("click"); 135 136 } 137 function colors_suggestions(){ 138 return [ 139 {name:'Padrão', border:'#3366cc', font:'#ffffff', background:'#3366cc'}, 140 {name:'Coala', border:'#123456', font:'#ffffff', background:'#385c80'}, 141 {name:'Tomate', border:'#d5130b', font:'#111111', background:'#e36d76'}, 142 {name:'Limão', border:'#32ed21', font:'#1f3f1c', background:'#b2f1ac'}, 143 {name:'Alto contraste', border:'#000000', font:'#ffffff', background:'#222222'} 144 ] 145 } 146 function rgb2hex(rgb){ 147 rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 148 return "#" + 149 ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) + 150 ("0" + parseInt(rgb[2],10).toString(16)).slice(-2) + 151 ("0" + parseInt(rgb[3],10).toString(16)).slice(-2); 152 } 153 154 function confirmDelete(id){ 155 $.Zebra_Dialog('<strong>Deseja excluir esse marcador?</strong>', { 156 'type': 'question', 157 'title': 'Atenção', 158 'buttons': ['Sim','Não'], 159 'onClose': function(caption) { 160 if(caption == 'Sim'){ 161 delete_label(id); 162 } 163 } 422 164 }); 165 } 166 function delete_label(id){ 167 $(".label-list li").each(function () { 168 var regex_match = $(this).attr("class").match(/label-item-([\d]+[()a-zA-Z]*)/); 169 if (regex_match && regex_match[1] && regex_match[1] == id) { 170 $(this).remove(); 171 } 172 }); 173 DataLayer.remove('label', id); 174 DataLayer.commit(); 175 winElement.find(".label-list li:first").trigger("click"); 176 177 if($(".label-list li").length == 0){ 178 winElement.find(".label-list-container").html('<ul class="label-list"><li class="empty-item">Nenhum Marcador Cadastrado.</li></ul>'); 179 } 180 var qtdLi = $(".label-list-container ul").find("li").not(".empty-item").length; 181 if (qtdLi == 0){ 182 $(".my-labels").addClass("hidden"); 183 $(".label-list-container ul").find(".empty-item").css("display",""); 184 winElement.find(".buttons .save-label .ui-button-text").text('Criar'); 185 $(".delete-label").button("disable"); 186 187 winElement.find('.input-nome').val(""); 188 winElement.find(".preview-label-inner").text(""); 189 190 var colorpicker = winElement.find('.lebals-colorpicker'); 191 colorpicker.find('input[name="backgroundColor"]').val("#ebebeb") 192 .css("background-color", "#ebebeb").focus().end() 193 .find('input[name="fontColor"]').val("#000000").css("background-color", "#000000").focus().end() 194 .find('input[name="borderColor"]').val("#000000").css("background-color", "#000000").focus().end() 195 .find('.preview-label-outer').css({ 196 'background-color':"#ebebeb", 197 'color':"#000000", 198 'border-color':"#000000" 199 }); 200 $(".input-nome").keyup(function () { 201 var value = $(this).val(); 202 winElement.find('.preview-label-inner').text(value); 203 }).keyup(); 204 } 205 } 206 function new_label(nameLabel, isNew){ 207 var labelCreated = { 208 uid: User.me.id, 209 name : nameLabel, 210 backgroundColor : !!isNew ? '#ebebeb' : winElement.find("input[name='backgroundColor']").val(), 211 fontColor : !!isNew ? '#000000' : winElement.find("input[name='fontColor']").val(), 212 borderColor :!!isNew ? '#000000' : winElement.find("input[name='borderColor']").val() 213 } 214 DataLayer.put('label', labelCreated); 215 216 $(".add-label-button").removeClass("ui-icon ui-icon-plus") 217 .html('<img alt="Carregando" title="Carregando" style="margin-left:10px;" src="../prototype/modules/mail/img/loader.gif" />'); 218 219 DataLayer.commit(false, false, function(){ 220 221 labels = DataLayer.get('label',{criteria:{order: 'id'}}, true); 222 newLabel = { 223 id: labels[labels.length - 1].id, 224 name : labels[labels.length- 1].name, 225 uid: User.me.id, 226 bgColor : !!isNew ? '#ebebeb' : winElement.find("input[name='backgroundColor']").val(), 227 fontColor : !!isNew ? '#000000' : winElement.find("input[name='fontColor']").val(), 228 borderColor : !!isNew ? '#000000' : winElement.find("input[name='borderColor']").val() 229 }; 230 231 $(".label-list-container ul").find(".empty-item").css("display","none"); 232 $(".label-list-container ul") 233 .prepend(DataLayer.render("../prototype/modules/mail/templates/label_listitem.ejs", newLabel)) 234 .find("li:first") 235 .fadeIn("slow").click(configureLabel); 236 237 $("#MyMarckersList") 238 .html( 239 "<div class='my-labels'>" + 240 "<img src='../prototype/modules/mail/img/tag.png'/>" + 241 "<a class='title-my-labels' tabindex='0' role='button' aria-expanded='false' title='Meus marcadores'>Meus marcadores</a>" + 242 243 "<span class='status-list-labels ui-icon ui-icon-triangle-1-s'></span>" + 244 "</div>" 245 ) 246 .append(DataLayer.render("../prototype/modules/mail/templates/label_list.ejs", {labels:DataLayer.get('label', true)} )) 247 .find("li.label-item").css({"background-color":"#ffffff", "border-color":"#CCCCCC", "color":"#444444"}) 248 .find(".square-color").css("display","").click(function(){ 249 $(this).parent(".label-item").each(function(){ 250 configureLabels({selectedItem: $(this).attr('class').match(/label-item-([\d]+[()a-zA-Z]*)/)[1]}); 251 }); 252 }); 253 $("#MyMarckersList a.title-my-labels").click(function() { 254 $("#MyMarckersList ul.label-list").toggleClass("hidden") 255 $('#MyMarckersList .status-list-labels').toggleClass("ui-icon-triangle-1-s"); 256 $('#MyMarckersList .status-list-labels').toggleClass("ui-icon-triangle-1-n"); 257 }); 258 259 $(".label-list-container .label-list li").not(".empty-item").click(function(){ 260 $(".label-list-container .label-list li").find("img").remove(); 261 $(".label-list-container .label-list li.label-item").removeClass("selected"); 262 $(this).prepend("<img src='../prototype/modules/mail/img/triangle.png' style='margin: 0 5px 0 -5px;'>"); 263 $(this).addClass("selected"); 264 }); 265 266 $(".label-list-container .label-list li").find('.button').button() 267 .filter('.edit').button({icons:{primary:'ui-icon-pencil'}, text:false}).end() 268 .filter('.close').button({icons:{primary:'ui-icon-close'}, text:false}); 269 270 //posiciona para edição o label inserido 271 winElement.find("ul.label-list li:first").trigger("click"); 272 winElement.find(".buttons .save-label .ui-button-text").text('Salvar'); 273 $(".delete-label").button("enable"); 274 275 winElement.find('.edit').unbind("click").click(editLabel); 276 winElement.find('.close').click(deleteLabel); 277 278 $(".my-labels").removeClass("hidden"); 279 280 $.contextMenu( 'destroy', ".table_box tbody tr"); 281 loadMenu(); 282 283 $(".add-label-button").empty() 284 .addClass("ui-icon ui-icon-plus"); 285 }); 286 287 } 288 function init_label(data){ 289 290 winElement = data.window; 291 292 //TODO Mudar quando API abstrair atualizações no cache 293 DataLayer.remove('label',false); 294 labels = DataLayer.get('label',{criteria:{order: 'name'}}); 295 296 if(labels){ 297 Label_List = winElement 298 .find(".label-list-container").html(DataLayer.render("../prototype/modules/mail/templates/label_list.ejs", {labels: labels})); 299 300 }else{ 301 //Exibe a mensagem informando o usuário de que não há nenhum marcador cadastrado. 302 Label_List = winElement 303 .find(".label-list-container").html('<ul class="label-list"><li class="empty-item">Nenhum Marcador Cadastrado.</li></ul>'); 304 305 } 306 Label_List.end() 307 .find('.button').button() 308 .filter('.edit').button({icons:{primary:'ui-icon-pencil'}, text:false}).end() 309 .filter('.close').button({icons:{primary:'ui-icon-close'}, text:false}); 310 311 winElement.find('.edit').click(editLabel); 312 winElement.find('.close').click(deleteLabel); 313 314 //marca 'd agua 315 winElement.find(".insert-label").Watermark(winElement.find(".insert-label").val()); 316 317 $("input.insert-label").keyup(function () { 318 $.Watermark.HideAll(); 319 var value = $(this).val(); 320 winElement.find('.input-nome').val(value); 321 }).keyup(); 322 323 if (!(labels)){ 324 winElement.find(".buttons .save-label .ui-button-text").text('Criar'); 325 $(".delete-label").button("disable"); 326 }else{ 327 winElement.find(".label-list li:first").addClass("selected").prepend("<img src='../prototype/modules/mail/img/triangle.png' style='margin: 0 5px 0 -5px;'>"); 328 } 329 $(".save-label").button("disable"); 330 /** 331 * seta a ação de click para os marcadores listados na tela 332 */ 333 winElement.find(".label-list li").not(".empty-item").click(configureLabel); 334 335 if (data.selectedItem) 336 winElement.find(".label-list li.label-item-"+data.selectedItem).trigger("click"); 337 else 338 winElement.find(".label-list li:first").trigger("click"); 339 340 var dataColorPicker = { 341 colorsSuggestions: colors_suggestions() 342 }; 343 344 winElement.find('select.color-suggestions').change(function() { 345 $(".save-label").button("enable"); 346 var colorpicker = winElement.find('.lebals-colorpicker'); 347 var colors; 348 if(colors = dataColorPicker.colorsSuggestions[$(this).val()]) { 349 colorpicker 350 .find('input[name="fontColor"]').val(colors.font).focus().end() 351 .find('input[name="backgroundColor"]').val(colors.background).focus().end() 352 .find('input[name="borderColor"]').val(colors.border).focus().end() 353 354 .find('.preview-label-outer').css({ 355 'background-color':dataColorPicker.colorsSuggestions[$(this).val()].background, 356 'border-color':dataColorPicker.colorsSuggestions[$(this).val()].border, 357 'color':dataColorPicker.colorsSuggestions[$(this).val()].font 358 }); 359 } 360 }); 361 var colorpickerPreviewChange = function(color) { 362 363 var pickedup = winElement.find('.colorwell-selected').val(color).css('background-color', color); 364 365 $(".save-label").button("enable"); 366 367 var colorpicker = winElement.find('.lebals-colorpicker'); 368 369 if (pickedup.is('input[name="backgroundColor"]')) { 370 colorpicker.find('.preview-label-outer').css('background-color',color); 371 } else if (pickedup.is('input[name="fontColor"]')) { 372 colorpicker.find('.preview-label-outer').css('color',color); 373 } else if (pickedup.is('input[name="borderColor"]')) { 374 colorpicker.find('.preview-label-outer').css('border-color',color); 375 } 376 } 377 378 var f = $.farbtastic(winElement.find('.colorpicker'), colorpickerPreviewChange); 379 var selected; 380 381 winElement.find('.colorwell').each(function () { 382 f.linkTo(this); 383 }) 384 .focus(function() { 385 if (selected) { 386 $(selected).removeClass('colorwell-selected'); 387 } 388 $(selected = this).addClass('colorwell-selected'); 389 f.linkTo(this, colorpickerPreviewChange); 390 f.linkTo(colorpickerPreviewChange); 391 }); 392 393 winElement.find(".add-label-button").click(function (event) { 394 $.Watermark.HideAll(); 395 var nameLabel = winElement.find(".insert-label").val(); 396 if(nameLabel.length >= 2){ 397 new_label(nameLabel, true); 398 $.Watermark.ShowAll(); 399 winElement.find(".insert-label").val(""); 400 } else { 401 alert("Mínimo 2 caracteres"); 402 } 403 event.stopImmediatePropagation(); 404 }); 405 406 winElement.find('.insert-label').keydown(function(event, ui) { 407 if (event.keyCode == 13) 408 winElement.find(".add-label-button").trigger('click'); 409 }); 410 411 //excluir marcador {deve ser para o botão grande na janela de edição e nao o pequeno da lista} 412 winElement.find(".buttons .delete-label").click(function(event){ 413 var id = winElement.find(".edit-label").val(); 414 confirmDelete(id); 415 event.stopImmediatePropagation(); 416 }); 417 418 $(".label-list-container .label-list li").not(".empty-item").click(function(){ 419 $(".label-list-container .label-list li").find("img").remove(); 420 $(".label-list-container .label-list li.label-item").removeClass("selected"); 421 $(this).prepend("<img src='../prototype/modules/mail/img/triangle.png' style='margin: 0 5px 0 -5px;'>"); 422 $(this).addClass("selected"); 423 }); 424 425 //salvar/criar marcador 426 winElement.find(".buttons .save-label").click(save_editLabel()); 423 427 //desfazer marcador 424 428 winElement.find(".buttons .undo-label").click(function(event){
Note: See TracChangeset
for help on using the changeset viewer.