1 31 32 package org.opencms.workplace.list; 33 34 import org.opencms.util.CmsStringUtil; 35 36 import java.text.MessageFormat ; 37 import java.util.Locale ; 38 39 48 public abstract class A_CmsListDefaultJsAction extends CmsListDefaultAction { 49 50 55 public A_CmsListDefaultJsAction(String id) { 56 57 super(id); 58 } 59 60 63 protected String resolveOnClic(Locale locale) { 64 65 String confirmationMessage = getConfirmationMessage().key(locale); 66 if (getColumnForTexts() != null && getItem().get(getColumnForTexts()) != null) { 67 confirmationMessage = new MessageFormat (confirmationMessage, locale).format(new Object [] {getItem().get( 68 getColumnForTexts())}); 69 } 70 StringBuffer onClic = new StringBuffer (128); 71 if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(confirmationMessage)) { 72 onClic.append("if (confirm('"); 73 onClic.append(confirmationMessage); 74 onClic.append("')) { "); 75 } 76 onClic.append(jsCode()); 77 if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(confirmationMessage)) { 78 onClic.append(" } "); 79 } 80 return onClic.toString(); 81 } 82 83 88 public abstract String jsCode(); 89 } | Popular Tags |