1 package com.teamkonzept.webman.field; 2 3 import com.teamkonzept.webman.mainint.*; 4 import com.teamkonzept.webman.mainint.db.queries.TKDBContentTreeGetType; 5 import com.teamkonzept.webman.mainint.db.queries.*; 6 import de.webman.content.eventhandler.CEUtils; 7 8 import com.teamkonzept.lib.*; 9 import com.teamkonzept.publishing.markups.*; 10 import com.teamkonzept.web.*; 11 import com.teamkonzept.field.db.*; 12 import com.teamkonzept.field.db.queries.*; 13 import com.teamkonzept.db.*; 14 import com.teamkonzept.field.*; 15 import de.webman.generator.*; 16 import com.teamkonzept.international.LanguageManager; 17 18 import java.sql.*; 19 import java.util.*; 20 import org.apache.log4j.Category; 21 22 28 public class TKDocumentTypeSelectorField 29 extends TKSelectField 30 { 31 33 36 public static final String CLASS_ID = "DOC_TYPE_LIST"; 37 38 41 private static final Category CATEGORY = Category.getInstance(TKDocumentTypeSelectorField.class); 42 43 46 public TKDocumentTypeSelectorField() {}; 47 48 53 public TKDocumentTypeSelectorField(String name, String showName) 54 { 55 initSelectorField( CLASS_ID, name, showName); 56 } 57 58 public void initSelectorField( 59 String type, 60 String name, 61 String showName 62 ) 63 { 64 initSelectField( type, name, showName, new TKVector(), 1, false ); 65 } 66 67 public void fillIntoTemplate( TKHTMLTemplate t, Object value, String prefix ) 68 { 69 TKVector tmpOptionList = optionList; 70 try { 71 TKQuery q = TKDBManager.newQuery( TKDBPresentationGet.class ); 72 q.execute(); 73 ResultSet res = q.fetchResultSet(); 74 TKVector newOptionList = new TKVector(); 75 76 newOptionList.addElement(new TKOptionFieldEntry(LanguageManager.getText("form", 79 "OPTIONLIST_POSSIBILITIES"), 80 "-1")); 81 82 while( res.next() ) { 83 String name = res.getString("PRESENTATION_NAME"); 84 newOptionList.addElement( 85 new TKOptionFieldEntry( 86 name, 87 String.valueOf( res.getInt("PRESENTATION_ID") ) 88 ) 89 ); 90 } 91 92 res.close(); 93 optionList = newOptionList; 94 } 95 catch( SQLException e ) { 96 CATEGORY.error("fillIntoTemplate: " ,e); 97 return; 98 } 99 super.fillIntoTemplate( t, value, prefix ); 100 optionList = tmpOptionList; 101 } 102 103 } 104 | Popular Tags |