Changeset 5881 for trunk/prototype
- Timestamp:
- 04/04/12 15:36:26 (12 years ago)
- Location:
- trunk/prototype
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/config/label.ini
r5533 r5881 8 8 clearAllLabeledsOfLabel = modules/mail/interceptors/Helpers.php 9 9 10 [before.create] 11 verifyNameLabel = modules/mail/interceptors/Helpers.php 12 10 13 [PostgreSQL.mapping] 11 14 id = id -
trunk/prototype/modules/mail/interceptors/Helpers.php
r5817 r5881 298 298 //$result = Controller::update($imap_uri, $params, $criteria); 299 299 } 300 301 302 //label:before.create 303 public function verifyNameLabel(&$uri , &$params , &$criteria , $original){ 304 $nameLabel = $params['name']; 305 $Labels = Controller::find(array('concept' => 'label'), false, array('filter' => array('=', 'name', $nameLabel) )); 306 if($Labels){ 307 //Throw new Exception('Marcador existe'); 308 //$params['id'] = 'Marcador existe'; 309 return false; 310 } 311 } 300 312 301 313 } -
trunk/prototype/modules/mail/js/label.js
r5824 r5881 134 134 }); 135 135 DataLayer.put('label', labelEdited.id, labelEdited); 136 DataLayer.commit(false, false, function(){ 137 138 winElement.find(".insert-label").val(""); 139 $.Watermark.ShowAll(); 140 141 $(".label-list-container .label-list li").find('.button').button() 142 .filter('.edit').button({icons:{primary:'ui-icon-pencil'}, text:false}).end() 143 .filter('.close').button({icons:{primary:'ui-icon-close'}, text:false}); 144 145 winElement.find('.edit').unbind("click").click(editLabel); 146 winElement.find('.close').click(deleteLabel); 147 148 draw_tree_labels(); 149 updateMessageLabels(labelEdited.id); 150 151 /** 152 * Atualiza menu remove o menu presente em cada mensagem listada em uma pasta 153 * e carrega novamente para que os dados sejam atualizados 154 */ 155 $.contextMenu( 'destroy', ".table_box tbody tr"); 156 loadMenu(); 136 DataLayer.commit(false, false, function(data){ 137 var hasLabel = true; 138 for(var i in data){ 139 if(parseInt(data[i].id)) 140 hasLabel = false; 141 } 142 if(!hasLabel){ 143 winElement.find(".insert-label").val(""); 144 $.Watermark.ShowAll(); 145 146 $(".label-list-container .label-list li").find('.button').button() 147 .filter('.edit').button({icons:{primary:'ui-icon-pencil'}, text:false}).end() 148 .filter('.close').button({icons:{primary:'ui-icon-close'}, text:false}); 149 150 winElement.find('.edit').unbind("click").click(editLabel); 151 winElement.find('.close').click(deleteLabel); 152 153 draw_tree_labels(); 154 updateMessageLabels(labelEdited.id); 155 156 /** 157 * Atualiza menu remove o menu presente em cada mensagem listada em uma pasta 158 * e carrega novamente para que os dados sejam atualizados 159 */ 160 $.contextMenu( 'destroy', ".table_box tbody tr"); 161 loadMenu(); 162 }else{ 163 $(".add-label-button").empty() 164 .addClass("ui-icon ui-icon-plus"); 165 alert('Problema ao salvar marcador.'); 166 } 157 167 }); 158 168 // criar marcador … … 231 241 .html('<img alt="Carregando" title="Carregando" style="margin-left:10px;" src="../prototype/modules/mail/img/loader.gif" />'); 232 242 233 DataLayer.commit(false, false, function(){ 234 235 labels = DataLayer.get('label',{criteria:{order: 'id'}}, true); 236 newLabel = { 237 id: labels[labels.length - 1].id, 238 name : labels[labels.length- 1].name, 239 uid: User.me.id, 240 bgColor : !!isNew ? '#ebebeb' : winElement.find("input[name='backgroundColor']").val(), 241 fontColor : !!isNew ? '#000000' : winElement.find("input[name='fontColor']").val(), 242 borderColor : !!isNew ? '#000000' : winElement.find("input[name='borderColor']").val() 243 }; 244 245 /** Marca as mensagens selecionadas com o marcador criado*/ 246 if(apply){ 247 labeledMessages(newLabel.id) 248 } 249 250 $(".label-list-container ul").find(".empty-item").css("display","none"); 251 $(".label-list-container ul") 252 .prepend(DataLayer.render("../prototype/modules/mail/templates/label_listitem.ejs", newLabel)) 253 .find("li:first") 254 .fadeIn("slow").click(configureLabel); 255 256 draw_tree_labels(); 257 258 $(".label-list-container .label-list li").not(".empty-item").click(function(){ 259 $(".label-list-container .label-list li").find("img").remove(); 260 $(".label-list-container .label-list li.label-item").removeClass("selected"); 261 $(this).prepend("<img src='../prototype/modules/mail/img/triangle.png' style='margin: 0 5px 0 -5px;'>"); 262 $(this).addClass("selected"); 263 }); 264 265 $(".label-list-container .label-list li").find('.button').button() 266 .filter('.edit').button({icons:{primary:'ui-icon-pencil'}, text:false}).end() 267 .filter('.close').button({icons:{primary:'ui-icon-close'}, text:false}); 268 269 //posiciona para edição o label inserido 270 winElement.find("ul.label-list li:first").trigger("click"); 271 winElement.find(".buttons .save-label .ui-button-text").text('Salvar'); 272 $(".delete-label").button("enable"); 273 274 winElement.find('.edit').unbind("click").click(editLabel); 275 winElement.find('.close').click(deleteLabel); 276 277 $(".my-labels").show(); 278 279 $.contextMenu( 'destroy', ".table_box tbody tr"); 280 loadMenu(); 281 282 $(".add-label-button").empty() 283 .addClass("ui-icon ui-icon-plus"); 243 DataLayer.commit(false, false, function(data){ 244 var hasLabel = true; 245 for(var i in data){ 246 if(parseInt(data[i].id)) 247 hasLabel = false; 248 } 249 if(!hasLabel){ 250 labels = DataLayer.get('label',{criteria:{order: 'id'}}, true); 251 newLabel = { 252 id: labels[labels.length - 1].id, 253 name : labels[labels.length- 1].name, 254 uid: User.me.id, 255 bgColor : !!isNew ? '#ebebeb' : winElement.find("input[name='backgroundColor']").val(), 256 fontColor : !!isNew ? '#000000' : winElement.find("input[name='fontColor']").val(), 257 borderColor : !!isNew ? '#000000' : winElement.find("input[name='borderColor']").val() 258 259 }; 260 261 /** Marca as mensagens selecionadas com o marcador criado*/ 262 if(apply){ 263 labeledMessages(newLabel.id) 264 } 265 266 $(".label-list-container ul").find(".empty-item").css("display","none"); 267 $(".label-list-container ul") 268 .prepend(DataLayer.render("../prototype/modules/mail/templates/label_listitem.ejs", newLabel)) 269 .find("li:first") 270 .fadeIn("slow").click(configureLabel); 271 272 draw_tree_labels(); 273 274 $(".label-list-container .label-list li").not(".empty-item").click(function(){ 275 $(".label-list-container .label-list li").find("img").remove(); 276 $(".label-list-container .label-list li.label-item").removeClass("selected"); 277 $(this).prepend("<img src='../prototype/modules/mail/img/triangle.png' style='margin: 0 5px 0 -5px;'>"); 278 $(this).addClass("selected"); 279 }); 280 281 $(".label-list-container .label-list li").find('.button').button() 282 .filter('.edit').button({icons:{primary:'ui-icon-pencil'}, text:false}).end() 283 .filter('.close').button({icons:{primary:'ui-icon-close'}, text:false}); 284 285 //posiciona para edição o label inserido 286 winElement.find("ul.label-list li:first").trigger("click"); 287 winElement.find(".buttons .save-label .ui-button-text").text('Salvar'); 288 $(".delete-label").button("enable"); 289 290 winElement.find('.edit').unbind("click").click(editLabel); 291 winElement.find('.close').click(deleteLabel); 292 293 $(".my-labels").show(); 294 295 $.contextMenu( 'destroy', ".table_box tbody tr"); 296 loadMenu(); 297 298 $(".add-label-button").empty() 299 .addClass("ui-icon ui-icon-plus"); 300 }else{ 301 $(".add-label-button").empty() 302 .addClass("ui-icon ui-icon-plus"); 303 alert('Problema ao salvar marcador.'); 304 } 284 305 }); 285 306 }
Note: See TracChangeset
for help on using the changeset viewer.