From 6b15c3aef67d153801c2818d3a3d3f2d959d3a7a Mon Sep 17 00:00:00 2001 From: Feiyun Date: Sat, 19 Oct 2013 00:54:58 +0800 Subject: [PATCH 001/520] adjust ui --- crm/src/main/java/com/rex/crm/TemplatePage.html | 4 ++-- crm/src/main/java/com/rex/crm/TemplatePage.java | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/crm/src/main/java/com/rex/crm/TemplatePage.html b/crm/src/main/java/com/rex/crm/TemplatePage.html index 919c413..854e36e 100755 --- a/crm/src/main/java/com/rex/crm/TemplatePage.html +++ b/crm/src/main/java/com/rex/crm/TemplatePage.html @@ -25,7 +25,7 @@ - -
-
-
-
- - - - - - - - - - - -
- -
-
-
-
- -
-
-
-
-
- - - - - - - - - - - - - - - - - -    - - + } + +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + +    + + \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.java b/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.java index 1f794f0..3a51937 100644 --- a/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.java +++ b/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.java @@ -54,7 +54,7 @@ public class NewDataFormPanel extends Panel { private String email = ""; private int port = 25; private Map> addFieldGroupMap = Maps.newHashMap(); - private static int NUM_OF_COLUMN = 3; + private static int NUM_OF_COLUMN = 1; final String user = ((SignIn2Session) getSession()).getUser(); public NewDataFormPanel(String id, final Entity entity,final Map relationIds) { super(id); @@ -116,7 +116,7 @@ public NewDataFormPanel(String id, final Entity entity,final Map if (j % 2 == 0) { columnitem.add(new TextFragment("celldatafield","textFragment",this, currentField.getDisplay() + ":").add(new AttributeAppender("style",new Model("font-weight:bold;"),";"))); - columnitem.add(new AttributeAppender("style",new Model("text-align:right;width:200px"),";")); + columnitem.add(new AttributeAppender("class",new Model("tag")," ")); } else { List pickList = DAOImpl .queryPickList(currentField.getPicklist()); @@ -134,7 +134,7 @@ public NewDataFormPanel(String id, final Entity entity,final Map } else if (currentField.getRelationTable() != null) { if (j % 2 == 0) { columnitem.add(new TextFragment("celldatafield","textFragment",this, currentField.getDisplay() +":").add(new AttributeAppender("style",new Model("font-weight:bold;"),";"))); - columnitem.add(new AttributeAppender("style",new Model("text-align:right;width:200px"),";")); + columnitem.add(new AttributeAppender("class",new Model("tag")," ")); } else { List pickList = DAOImpl.queryRelationDataList(currentField.getRelationTable(),userId); Map list = Maps.newHashMap(); @@ -162,7 +162,7 @@ public NewDataFormPanel(String id, final Entity entity,final Map } else { if (j % 2 == 0) { columnitem.add(new TextFragment("celldatafield","textFragment",this, currentField.getDisplay() + ":").add(new AttributeAppender("style",new Model("font-weight:bold;"),";"))); - columnitem.add(new AttributeAppender("style",new Model("text-align:right;width:200px"),";")); + columnitem.add(new AttributeAppender("class",new Model("tag")," ")); } else { if(currentField.getName().equals("address")){ IModel textModel = new Model(""); diff --git a/crm/src/main/webapp/css/extra.css b/crm/src/main/webapp/css/extra.css index 01d8508..901cd70 100644 --- a/crm/src/main/webapp/css/extra.css +++ b/crm/src/main/webapp/css/extra.css @@ -43,10 +43,43 @@ a:hover, a:focus { background: #fff; } -@media ( max-width : 768px) { +.table-column { + float: left; + width: 220px; + text-align: right; + padding-right: 10px; +} +.table-cell { + display: inline-block; + border-bottom: solid; + border-bottom-width: 1px; + border-bottom-color: #ddd; + padding-bottom: 5px; +} +.table-content { + margin-left: 20px; +} +.table-header { + width: 100%; + display: inline-block; + border-bottom: solid; + border-bottom-width: 1px; + border-bottom-color: #ddd; + margin-bottom: 5px; +} +.navbar .brand { + padding-right: 1px; +} +.tag{ + width: 130px; +} +@media ( max-width : 767px) { /* Enable use of floated navbar text */ + .btn.btn-sm.btn-danger.btn-mini { + margin-right: 5px; + } .btn.dropdown-toggle.clearfix.btn-primary { - margin-right: 10px; + margin-right: 5px; } .nav-tabs > li{ width:100%; @@ -94,7 +127,7 @@ a:hover, a:focus { padding-left: 9px; padding-right: 9px; display:block; - margin-right: 20px; + margin-right: 10px; } .btn.clearfix.btn-info.btn-menu.navbar-toggle.collapsed{ width: 32px; @@ -128,3 +161,24 @@ a:hover, a:focus { margin-top: -9px; } } + +@media ( max-width : 440px) { + .table-column { + float: left; + text-align: left; + width: 100%; + } + .form_datetime > input { + width: 100%; + } + .form_datetime > select { + width: 100%; + } + .table-cell { + width: 100%; + padding-right: 10px; + } + .form_datetime { + padding-right: 12px; + } +} \ No newline at end of file From 7368dfa2c1eead87266b0b07122cf0dd78522c7d Mon Sep 17 00:00:00 2001 From: MikeLee Date: Tue, 22 Oct 2013 14:51:49 +0800 Subject: [PATCH 035/520] Edit panel altered Support resposive UI. --- .../com/rex/crm/common/EditDataFormPanel.html | 101 ++- .../com/rex/crm/common/EditDataFormPanel.java | 8 +- .../java/com/rex/crm/common/EditDataPage.html | 50 +- .../com/rex/crm/common/EntityDetailPanel.html | 10 +- .../com/rex/crm/common/EntityDetailPanel.java | 84 +-- .../com/rex/crm/common/NewDataFormPanel.java | 664 +++++++++--------- crm/src/main/webapp/css/extra.css | 17 +- 7 files changed, 473 insertions(+), 461 deletions(-) diff --git a/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.html b/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.html index 53f320b..3800420 100644 --- a/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.html +++ b/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.html @@ -1,57 +1,54 @@ - + -
-
-
-
-
-
- - - - - - - - - - - -
- -
-
-
-
- -
-
-
-
-
-
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
-
+
- - - - - - - - - - - - - - -    - - + + + + + + + + + + + + + + +    + +
diff --git a/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.java b/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.java index afa079e..4ce4374 100644 --- a/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.java +++ b/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.java @@ -50,7 +50,7 @@ public class EditDataFormPanel extends Panel { private final String user = ((SignIn2Session) getSession()).getUser(); private Map> fieldGroupMap = Maps.newHashMap(); - private static int NUM_OF_COLUMN = 3; + private static int NUM_OF_COLUMN = 1; /** * @@ -126,7 +126,7 @@ public EditDataFormPanel(String id, final Entity schema, Map data,final String if (currentField.getPicklist() != null) { if (j % 2 == 0) { columnitem.add(new TextFragment("editdata","textFragment", this, currentField.getDisplay() + ":").add(new AttributeAppender("style",new Model("font-weight:bold;"),";"))); - columnitem.add(new AttributeAppender("style",new Model("text-align:right;width:200px"),";")); + columnitem.add(new AttributeAppender("class", new Model("tag"), " ")); fieldNames.add(currentField.getName()); } else { List pickList = DAOImpl.queryPickList(currentField.getPicklist()); @@ -147,7 +147,7 @@ public EditDataFormPanel(String id, final Entity schema, Map data,final String else if (currentField.getRelationTable() != null) { if (j % 2 == 0) { columnitem.add(new TextFragment("editdata","textFragment",this, currentField.getDisplay() +":").add(new AttributeAppender("style",new Model("font-weight:bold;"),";"))); - columnitem.add(new AttributeAppender("style",new Model("text-align:right;width:200px"),";")); + columnitem.add(new AttributeAppender("class", new Model("tag"), " ")); fieldNames.add(currentField.getName()); } else { long foreignKey = 1L; @@ -174,7 +174,7 @@ else if (currentField.getRelationTable() != null) { else { if (j % 2 == 0) { columnitem.add(new TextFragment("editdata","textFragment", this, currentField.getDisplay() + ":").add(new AttributeAppender("style",new Model("font-weight:bold;"),";"))); - columnitem.add(new AttributeAppender("style",new Model("text-align:right;width:200px"),";")); + columnitem.add(new AttributeAppender("class", new Model("tag"), " ")); fieldNames.add(currentField.getName()); } else { diff --git a/crm/src/main/java/com/rex/crm/common/EditDataPage.html b/crm/src/main/java/com/rex/crm/common/EditDataPage.html index d503868..dd6de2f 100644 --- a/crm/src/main/java/com/rex/crm/common/EditDataPage.html +++ b/crm/src/main/java/com/rex/crm/common/EditDataPage.html @@ -1,32 +1,32 @@ - - - -
-
- -
-
- -
-
- 我的 -
+ }); + +
+
+ -
+
+ +
+
+ 我的 +
+
-
-
-
-
-
- - + +
+
+ +
+
+
+ diff --git a/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.html b/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.html index 75bbd48..1dfcb77 100755 --- a/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.html +++ b/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.html @@ -23,11 +23,11 @@
- - - - -
+
+
+
+
+
diff --git a/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.java b/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.java index cdd516d..86fb44e 100644 --- a/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.java +++ b/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.java @@ -30,16 +30,15 @@ import com.rex.crm.util.Configuration; public class EntityDetailPanel extends Panel { - private static final Logger logger = Logger.getLogger(EntityDetailPanel.class); - private static final long serialVersionUID = -2613412283023068638L; - private Map> fieldGroupMap = Maps.newHashMap(); + private static final Logger logger = Logger.getLogger(EntityDetailPanel.class); + private static final long serialVersionUID = -2613412283023068638L; + private Map> fieldGroupMap = Maps.newHashMap(); + private int number_of_column = 1; - private int number_of_column = 3; - - public EntityDetailPanel(String id, final Entity schema, final Map data, String entityId,int number_of_column,final String pageName) { + public EntityDetailPanel(String id, final Entity schema, final Map data, String entityId, int number_of_column, final String pageName) { super(id); - this.number_of_column = number_of_column; +// this.number_of_column = number_of_column; // TODO Get permission info of user from database. // add(new // CRUDPanel("operationBar",EnumSet.of(CRUDPanel.Permissions.DEL,CRUDPanel.Permissions.EDIT))); @@ -64,7 +63,9 @@ public EntityDetailPanel(String id, final Entity schema, final Map data, String int gNum = 0; for (String gn : groupNames) { List groupfields = fieldGroupMap.get(gn); - if(groupfields == null) continue; + if (groupfields == null) { + continue; + } AbstractItem groupitem = new AbstractItem(fieldGroupRepeater.newChildId()); fieldGroupRepeater.add(groupitem); WebMarkupContainer container = new WebMarkupContainer("divButton"); @@ -78,77 +79,80 @@ public EntityDetailPanel(String id, final Entity schema, final Map data, String AbstractItem div = new AbstractItem(divRepeater.newChildId()); divRepeater.add(div); div.add(new AttributeAppender("id", new Model("2" + (--gNum)), ";")); - if(!(gNum==0)){ - div.add(new AttributeAppender("class", new Model("collapse" ), ";")); - }else{ - div.add(new AttributeAppender("class", new Model("collapse in" ), ";")); + if (!(gNum == 0)) { + div.add(new AttributeAppender("class", new Model("collapse"), ";")); + } else { + div.add(new AttributeAppender("class", new Model("collapse in"), ";")); } gNum++; RepeatingView dataRowRepeater = new RepeatingView("dataRowRepeater"); div.add(dataRowRepeater); int numOfField = 0; List visibleFields = Lists.newArrayList(); - + for (Field f : groupfields) { - if (!f.isVisible() || f.getName().equalsIgnoreCase("name")) + if (!f.isVisible() || f.getName().equalsIgnoreCase("name")) { continue; + } numOfField++; visibleFields.add(f); } groupitem.add(new Label("groupname", gn)); - - int num_of_row = (numOfField / number_of_column) + 1; + + int num_of_row = (numOfField / this.number_of_column) + 1; for (int i = 0; i < num_of_row; i++) { AbstractItem item = new AbstractItem(dataRowRepeater.newChildId()); dataRowRepeater.add(item); RepeatingView columnRepeater = new RepeatingView("columnRepeater"); item.add(columnRepeater); - if(data == null) continue; - for (int j = 0; j < 2 * number_of_column; j++) { + if (data == null) { + continue; + } + for (int j = 0; j < 2 * this.number_of_column; j++) { AbstractItem columnitem = new AbstractItem(columnRepeater.newChildId(), new Model(String.valueOf(data.get(primaryKeyName)))); - if ((i * number_of_column + j / 2) >= visibleFields.size()) { - if((i * number_of_column + j / 2) >= visibleFields.size()){ - continue; - } + if ((i * this.number_of_column + j / 2) >= visibleFields.size()) { + if ((i * this.number_of_column + j / 2) >= visibleFields.size()) { + continue; + } columnitem.add(new Label("celldata", " ").setEscapeModelStrings(false)); columnRepeater.add(columnitem); continue; } - Field currentField = visibleFields.get(i * number_of_column + j / 2); + Field currentField = visibleFields.get(i * this.number_of_column + j / 2); if (currentField.getPicklist() != null) { if (j % 2 == 0) { columnitem.add(new Label("celldata", currentField.getDisplay() + ":").add(new AttributeAppender("style", new Model("font-weight:bold;"), ";"))); - columnitem.add(new AttributeAppender("style", new Model("text-align:right;width:200px"), ";")); + columnitem.add(new AttributeAppender("class", new Model("tag"), " ")); } else { - String value = CRMUtility.formatValue(currentField.getFormatter(),DAOImpl.queryPickListByIdCached(currentField.getPicklist(), String.valueOf(data.get(currentField.getName())))); + String value = CRMUtility.formatValue(currentField.getFormatter(), DAOImpl.queryPickListByIdCached(currentField.getPicklist(), String.valueOf(data.get(currentField.getName())))); value = (value == null) ? "" : value; columnitem.add(new Label("celldata", value).setEscapeModelStrings(false)); - columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); +// columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); } } else if (currentField.getRelationTable() != null) { if (j % 2 == 0) { columnitem.add(new Label("celldata", currentField.getDisplay() + ":").add(new AttributeAppender("style", new Model("font-weight:bold;"), ";"))); - columnitem.add(new AttributeAppender("style", new Model("text-align:right;width:200px"), ";")); + columnitem.add(new AttributeAppender("class", new Model("tag"), " ")); } else { String value = CRMUtility.formatValue(currentField.getFormatter(), DAOImpl.queryCachedRelationDataById(currentField.getRelationTable(), String.valueOf(data.get(currentField.getName())))); value = (value == null) ? "" : value; - if((currentField.getName().equals("accountId"))){ - columnitem.add(new DetailLinkFragment("celldata", "detailFragment", this, value)); - columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); - }else{ - columnitem.add(new Label("celldata", value).setEscapeModelStrings(false)); - columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); + if ((currentField.getName().equals("accountId"))) { + columnitem.add(new DetailLinkFragment("celldata", "detailFragment", this, value)); +// columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); + } else { + columnitem.add(new Label("celldata", value).setEscapeModelStrings(false)); +// columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); } } } else { if (j % 2 == 0) { columnitem.add(new Label("celldata", currentField.getDisplay() + ":").add(new AttributeAppender("style", new Model("font-weight:bold;"), ";"))); - columnitem.add(new AttributeAppender("style", new Model("text-align:right;width:200px"), ";")); + columnitem.add(new AttributeAppender("class", new Model("tag"), " ")); } else { Object rawvalue = data.get(currentField.getName()); rawvalue = (rawvalue == null) ? "" : rawvalue; @@ -158,8 +162,8 @@ public EntityDetailPanel(String id, final Entity schema, final Map data, String // columnitem.add(new DetailLinkFragment("celldata", "detailFragment", this, value)); // columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); // }else{ - columnitem.add(new Label("celldata", value).setEscapeModelStrings(false)); - columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); + columnitem.add(new Label("celldata", value).setEscapeModelStrings(false)); +// columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); // } } } @@ -168,7 +172,6 @@ public EntityDetailPanel(String id, final Entity schema, final Map data, String }// end of set the detailed info }// end of groupNames loop add(new AbstractAjaxBehavior() { - @Override public void onRequest() { } @@ -178,18 +181,19 @@ public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(OnDomReadyHeaderItem.forScript("$(\"#navitem-" + pageName + "\").addClass(\"active\");")); } - }); } + private class DetailLinkFragment extends Fragment { - public DetailLinkFragment(String id, String markupId, MarkupContainer markupProvider, String caption) { + + public DetailLinkFragment(String id, String markupId, MarkupContainer markupProvider, String caption) { super(id, markupId, markupProvider); final String str = DAOImpl.queryEntityByName(caption); logger.debug("ididididididididididdidi" + str); add(new Link("detailclick") { @Override public void onClick() { - + setResponsePage(new EntityDetailPage("account", str)); } }.add(new Label("caption", new Model(caption)))); diff --git a/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.java b/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.java index 3a51937..8c5baf6 100644 --- a/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.java +++ b/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.java @@ -48,332 +48,332 @@ import com.sun.mail.smtp.SMTPTransport; public class NewDataFormPanel extends Panel { - private static final Logger logger = Logger - .getLogger(NewDataFormPanel.class); - private Properties server = new Properties(); + + private static final Logger logger = Logger + .getLogger(NewDataFormPanel.class); + private Properties server = new Properties(); private String email = ""; private int port = 25; - private Map> addFieldGroupMap = Maps.newHashMap(); - private static int NUM_OF_COLUMN = 1; - final String user = ((SignIn2Session) getSession()).getUser(); - public NewDataFormPanel(String id, final Entity entity,final Map relationIds) { - super(id); - final Map models = Maps.newHashMap(); + private Map> addFieldGroupMap = Maps.newHashMap(); + private static int NUM_OF_COLUMN = 1; + final String user = ((SignIn2Session) getSession()).getUser(); + + public NewDataFormPanel(String id, final Entity entity, final Map relationIds) { + super(id); + final Map models = Maps.newHashMap(); // final Map fieldNameToModel = Maps.newHashMap(); - final String userId = ((SignIn2Session) getSession()).getUserId(); - List fields = entity.getFields(); - // List fn = schema.getFieldNames(); - for (Field f : fields) { - if (addFieldGroupMap.get(f.getFieldGroup()) != null) { - addFieldGroupMap.get(f.getFieldGroup()).add(f); - } else { - List fs = Lists.newArrayList(); - fs.add(f); - addFieldGroupMap.put(f.getFieldGroup(), fs); - } - - } - List groupNames = Configuration.getSortedFieldGroupNames(); - RepeatingView fieldGroupRepeater = new RepeatingView("fieldGroupRepeater"); - add(fieldGroupRepeater); - for (String gn : groupNames) { - List groupfields = addFieldGroupMap.get(gn); - if (groupfields == null) - continue; - RepeatingView dataRowRepeater = new RepeatingView("dataRowRepeater"); - AbstractItem groupitem = new AbstractItem(fieldGroupRepeater.newChildId()); - groupitem.setOutputMarkupId(true); - fieldGroupRepeater.add(groupitem); - groupitem.add(dataRowRepeater); - int numOfField = 0; - List visibleFields = Lists.newArrayList(); - for (Field f : groupfields) { - if (!f.isVisible() ) - continue; - numOfField++; - visibleFields.add(f); - } - groupitem.add(new Label("groupname", gn)); - int num_of_row = (numOfField / NUM_OF_COLUMN) + 1; - for (int i = 0; i < num_of_row; i++) { - AbstractItem item = new AbstractItem(dataRowRepeater.newChildId()); - dataRowRepeater.add(item); - RepeatingView columnRepeater = new RepeatingView("columnRepeater"); - item.add(columnRepeater); - for (int j = 0; j < 2 * NUM_OF_COLUMN; j++) { - AbstractItem columnitem = new AbstractItem(columnRepeater.newChildId(), new Model()); - if ((i * NUM_OF_COLUMN + j / 2) >= visibleFields.size()) { - if((i * NUM_OF_COLUMN + j / 2) >= visibleFields.size()){ - continue; - } - columnitem.add(new LayoutFragment("celldatafield", "layoutFragment",this," ").setEscapeModelStrings(false)); - columnRepeater.add(columnitem); - - continue; - } - Field currentField = visibleFields.get(i * NUM_OF_COLUMN+ j / 2); - if (currentField.getPicklist() != null) { - - if (j % 2 == 0) { - columnitem.add(new TextFragment("celldatafield","textFragment",this, currentField.getDisplay() + ":").add(new AttributeAppender("style",new Model("font-weight:bold;"),";"))); - columnitem.add(new AttributeAppender("class",new Model("tag")," ")); - } else { - List pickList = DAOImpl - .queryPickList(currentField.getPicklist()); - Map list = Maps.newHashMap(); - List ids = Lists.newArrayList(); - for (Choice p : pickList) { - list.put(p.getId(), p.getVal()); - ids.add(p.getId()); - } - IModel choiceModel = new Model(1L); - models.put(currentField.getName(), choiceModel); - columnitem.add(new DropDownChoiceFragment("celldatafield", "dropDownFragment", this,ids, list, choiceModel)); - - } - } else if (currentField.getRelationTable() != null) { - if (j % 2 == 0) { - columnitem.add(new TextFragment("celldatafield","textFragment",this, currentField.getDisplay() +":").add(new AttributeAppender("style",new Model("font-weight:bold;"),";"))); - columnitem.add(new AttributeAppender("class",new Model("tag")," ")); - } else { - List pickList = DAOImpl.queryRelationDataList(currentField.getRelationTable(),userId); - Map list = Maps.newHashMap(); - List ids = Lists.newArrayList(); - for (Choice p : pickList) { - list.put(p.getId(), p.getVal()); - ids.add(p.getId()); - } - long foreignKey = -1L; - if (relationIds != null&& relationIds.containsKey(currentField.getAlias())) { - foreignKey = Long.parseLong(relationIds.get(currentField.getAlias())); - } - IModel choiceModel = new Model(foreignKey); - String fn = ""; - if (currentField.getAlias() != null) { - fn = currentField.getAlias(); - } else { - fn = currentField.getName(); - } - models.put(fn, choiceModel); - //columnitem.add(new DropDownChoiceFragment("celldatafield", "dropDownFragment", this,ids, list, choiceModel)); - - columnitem.add(new RelationTableSearchFragment("celldatafield","relationTableSearchFragment",this,currentField.getRelationTable(),"",choiceModel)); - } - } else { - if (j % 2 == 0) { - columnitem.add(new TextFragment("celldatafield","textFragment",this, currentField.getDisplay() + ":").add(new AttributeAppender("style",new Model("font-weight:bold;"),";"))); - columnitem.add(new AttributeAppender("class",new Model("tag")," ")); - } else { - if(currentField.getName().equals("address")){ - IModel textModel = new Model(""); - models.put(currentField.getName(), textModel); - columnitem.add(new Textarea("celldatafield","textAreaFragment", this, textModel)); - }else{ - IModel textModel = new Model(""); - models.put(currentField.getName(), textModel); - columnitem.add(new TextInputFragment("celldatafield","textInputFragment", this, textModel,currentField)); - } - } - } - columnRepeater.add(columnitem); - - } - } - } - - - Form form = new Form("form") { - @Override - protected void onSubmit() { - logger.debug("the form was submitted!"); - logger.debug(models); - List fieldNames = Lists.newArrayList(); - List values = Lists.newArrayList(); - for (String key : models.keySet()) { - fieldNames.add(key); - System.out.println(fieldNames); - // models.get(key).getObject() - if (models.get(key).getObject() instanceof String) { - values.add("'" + (String) models.get(key).getObject() - + "'"); - } else { - values.add(String.valueOf(models.get(key).getObject())); - } - } - - //if entity is crmuser add loginName - if("crmuser".equals(entity.getName())){ - String random = ""; - random = DAOImpl.createNewCrmUser(entity.getName(),fieldNames, values,userId); - if(!"".equals(random)){ - //此时需发送邮件 - String crmUserCode = String.valueOf(models.get("loginName").getObject()); - String sendEmail = String.valueOf(models.get("email").getObject()); - //创建激活码 getUserByuserCode - //传递邮箱地址,用户code. - sendMail(crmUserCode,sendEmail); - } - }else{ - long generatedId = DAOImpl.createNewRecord(entity.getName(),fieldNames, values,userId); - if (generatedId > 0) { - DAOImpl.insert2UserRelationTable(entity.getName(), userId, - String.valueOf(generatedId)); - } - } - setResponsePage(PageFactory.createPage(entity.getName())); - - } - }; - form.add(fieldGroupRepeater); - add(form); - - // form.add(new AjaxSubmitLink("save") { - // @Override - // protected void onSubmit(AjaxRequestTarget target, Form form) { - // System.out.println("form" + form); - // for (IModel m : models) { - // System.out.println("value:" + m.getObject()); - // } - // - // } - // }); - } - - public NewDataFormPanel(String id, IModel model) { - super(id, model); - } - - private class TextFragment extends Fragment{ - - public TextFragment(String id, String markupId, - MarkupContainer markupProvider, String label) { - super(id, markupId, markupProvider); - add(new Label("celldata", label)); - // TODO Auto-generated constructor stub - } - } - - private class LayoutFragment extends Fragment{ - - public LayoutFragment(String id, String markupId, - MarkupContainer markupProvider, String label) { - super(id, markupId, markupProvider); - add(new Label("add", label)); - // TODO Auto-generated constructor stub - } - - - } - private class DropDownChoiceFragment extends Fragment { - public DropDownChoiceFragment(String id, String markupId, - MarkupContainer markupProvider, final List ids, - final Map list, IModel model) { - super(id, markupId, markupProvider); - - add(new DropDownChoice("dropDownInput", model, ids, - new IChoiceRenderer() { - - @Override - public Object getDisplayValue(Long id) { - // TODO Auto-generated method stub - return list.get(id); - } - - @Override - public String getIdValue(Long id, int index) { - return String.valueOf(id); - } - - })); - } - } - - private class Textarea extends Fragment { - - public Textarea(String id, String markupId, MarkupContainer markupProvider,IModel model) - { - super(id, markupId, markupProvider); - // TODO Auto-generated constructor stub - add(new TextArea("address",model)); + final String userId = ((SignIn2Session) getSession()).getUserId(); + List fields = entity.getFields(); + // List fn = schema.getFieldNames(); + for (Field f : fields) { + if (addFieldGroupMap.get(f.getFieldGroup()) != null) { + addFieldGroupMap.get(f.getFieldGroup()).add(f); + } else { + List fs = Lists.newArrayList(); + fs.add(f); + addFieldGroupMap.put(f.getFieldGroup(), fs); + } + + } + List groupNames = Configuration.getSortedFieldGroupNames(); + RepeatingView fieldGroupRepeater = new RepeatingView("fieldGroupRepeater"); + add(fieldGroupRepeater); + for (String gn : groupNames) { + List groupfields = addFieldGroupMap.get(gn); + if (groupfields == null) { + continue; + } + RepeatingView dataRowRepeater = new RepeatingView("dataRowRepeater"); + AbstractItem groupitem = new AbstractItem(fieldGroupRepeater.newChildId()); + groupitem.setOutputMarkupId(true); + fieldGroupRepeater.add(groupitem); + groupitem.add(dataRowRepeater); + int numOfField = 0; + List visibleFields = Lists.newArrayList(); + for (Field f : groupfields) { + if (!f.isVisible()) { + continue; + } + numOfField++; + visibleFields.add(f); + } + groupitem.add(new Label("groupname", gn)); + int num_of_row = (numOfField / NUM_OF_COLUMN) + 1; + for (int i = 0; i < num_of_row; i++) { + AbstractItem item = new AbstractItem(dataRowRepeater.newChildId()); + dataRowRepeater.add(item); + RepeatingView columnRepeater = new RepeatingView("columnRepeater"); + item.add(columnRepeater); + for (int j = 0; j < 2 * NUM_OF_COLUMN; j++) { + AbstractItem columnitem = new AbstractItem(columnRepeater.newChildId(), new Model()); + if ((i * NUM_OF_COLUMN + j / 2) >= visibleFields.size()) { + if ((i * NUM_OF_COLUMN + j / 2) >= visibleFields.size()) { + continue; + } + columnitem.add(new LayoutFragment("celldatafield", "layoutFragment", this, " ").setEscapeModelStrings(false)); + columnRepeater.add(columnitem); + + continue; + } + Field currentField = visibleFields.get(i * NUM_OF_COLUMN + j / 2); + if (currentField.getPicklist() != null) { + + if (j % 2 == 0) { + columnitem.add(new TextFragment("celldatafield", "textFragment", this, currentField.getDisplay() + ":").add(new AttributeAppender("style", new Model("font-weight:bold;"), ";"))); + columnitem.add(new AttributeAppender("class", new Model("tag"), " ")); + } else { + List pickList = DAOImpl + .queryPickList(currentField.getPicklist()); + Map list = Maps.newHashMap(); + List ids = Lists.newArrayList(); + for (Choice p : pickList) { + list.put(p.getId(), p.getVal()); + ids.add(p.getId()); + } + IModel choiceModel = new Model(1L); + models.put(currentField.getName(), choiceModel); + columnitem.add(new DropDownChoiceFragment("celldatafield", "dropDownFragment", this, ids, list, choiceModel)); + + } + } else if (currentField.getRelationTable() != null) { + if (j % 2 == 0) { + columnitem.add(new TextFragment("celldatafield", "textFragment", this, currentField.getDisplay() + ":").add(new AttributeAppender("style", new Model("font-weight:bold;"), ";"))); + columnitem.add(new AttributeAppender("class", new Model("tag"), " ")); + } else { + List pickList = DAOImpl.queryRelationDataList(currentField.getRelationTable(), userId); + Map list = Maps.newHashMap(); + List ids = Lists.newArrayList(); + for (Choice p : pickList) { + list.put(p.getId(), p.getVal()); + ids.add(p.getId()); + } + long foreignKey = -1L; + if (relationIds != null && relationIds.containsKey(currentField.getAlias())) { + foreignKey = Long.parseLong(relationIds.get(currentField.getAlias())); + } + IModel choiceModel = new Model(foreignKey); + String fn = ""; + if (currentField.getAlias() != null) { + fn = currentField.getAlias(); + } else { + fn = currentField.getName(); + } + models.put(fn, choiceModel); + //columnitem.add(new DropDownChoiceFragment("celldatafield", "dropDownFragment", this,ids, list, choiceModel)); + + columnitem.add(new RelationTableSearchFragment("celldatafield", "relationTableSearchFragment", this, currentField.getRelationTable(), "", choiceModel)); + } + } else { + if (j % 2 == 0) { + columnitem.add(new TextFragment("celldatafield", "textFragment", this, currentField.getDisplay() + ":").add(new AttributeAppender("style", new Model("font-weight:bold;"), ";"))); + columnitem.add(new AttributeAppender("class", new Model("tag"), " ")); + } else { + if (currentField.getName().equals("address")) { + IModel textModel = new Model(""); + models.put(currentField.getName(), textModel); + columnitem.add(new Textarea("celldatafield", "textAreaFragment", this, textModel)); + } else { + IModel textModel = new Model(""); + models.put(currentField.getName(), textModel); + columnitem.add(new TextInputFragment("celldatafield", "textInputFragment", this, textModel, currentField)); + } + } + } + columnRepeater.add(columnitem); + + } + } + } + + + Form form = new Form("form") { + @Override + protected void onSubmit() { + logger.debug("the form was submitted!"); + logger.debug(models); + List fieldNames = Lists.newArrayList(); + List values = Lists.newArrayList(); + for (String key : models.keySet()) { + fieldNames.add(key); + System.out.println(fieldNames); + // models.get(key).getObject() + if (models.get(key).getObject() instanceof String) { + values.add("'" + (String) models.get(key).getObject() + + "'"); + } else { + values.add(String.valueOf(models.get(key).getObject())); + } + } + + //if entity is crmuser add loginName + if ("crmuser".equals(entity.getName())) { + String random = ""; + random = DAOImpl.createNewCrmUser(entity.getName(), fieldNames, values, userId); + if (!"".equals(random)) { + //此时需发送邮件 + String crmUserCode = String.valueOf(models.get("loginName").getObject()); + String sendEmail = String.valueOf(models.get("email").getObject()); + //创建激活码 getUserByuserCode + //传递邮箱地址,用户code. + sendMail(crmUserCode, sendEmail); + } + } else { + long generatedId = DAOImpl.createNewRecord(entity.getName(), fieldNames, values, userId); + if (generatedId > 0) { + DAOImpl.insert2UserRelationTable(entity.getName(), userId, + String.valueOf(generatedId)); + } + } + setResponsePage(PageFactory.createPage(entity.getName())); + + } + }; + form.add(fieldGroupRepeater); + add(form); + + // form.add(new AjaxSubmitLink("save") { + // @Override + // protected void onSubmit(AjaxRequestTarget target, Form form) { + // System.out.println("form" + form); + // for (IModel m : models) { + // System.out.println("value:" + m.getObject()); + // } + // + // } + // }); } -} - - private class RelationTableSearchFragment extends Fragment { - public RelationTableSearchFragment(String id, String markupId, - MarkupContainer markupProvider, final String entityName,final String value, IModel model) { - super(id, markupId, markupProvider); - - PageParameters params = new PageParameters(); - params.set("en", entityName); - params.set("target", (long)model.getObject()); - PopupSettings popupSettings = new PopupSettings("查找").setHeight(470) - .setWidth(850).setLeft(150).setTop(200); - add(new BookmarkablePageLink("search_btn", SelectEntryPage.class,params).setPopupSettings(popupSettings)); - HiddenField hidden = new HiddenField("selected_id_hidden" ,model); - hidden.add(new AttributeAppender("id",entityName+"_id")); - add(hidden); - TextField text = new TextField("selected_value_input" ,new Model(value)); - text.add(new AttributeAppender("id",entityName+"_name")); - add(text); - } - } - - - - private class TextInputFragment extends Fragment { - public TextInputFragment(String id, String markupId, - MarkupContainer markupProvider, IModel model,Field currentField) { - super(id, markupId, markupProvider); - TextField text = new TextField("input", model); - if(!currentField.isEditable()){ - Calendar calendar = Calendar.getInstance(); - SimpleDateFormat dateformat = new SimpleDateFormat("YYYY-MM-dd HH:mm"); - Date time =(Date)calendar.getTime(); - if(currentField.getName().equals("accountId")){ - add(text); - }else{ - if(currentField.getName().equals("modify_datetime")){ - String modify_datetime = dateformat.format(time); - text.add(new AttributeAppender("value", new Model(modify_datetime), ";")); - }else if(currentField.getName().equals("whenadded")){ - String whenadded = dateformat.format(time); - text.add(new AttributeAppender("value", new Model(whenadded), ";")); - }else{ - text.add(new AttributeAppender("value", new Model(user), ";")); - } - - } - text.add(new AttributeAppender("readonly",new Model("realonly"),";")); - } - if(currentField.getDataType().equals("tel")||currentField.getName().equals("fax")||currentField.getName().equals("office_fax")){ - text.add(new AttributeAppender("pattern",new Model("^((\\d{11})|^((\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1})|(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1}))$)"),";")); - } - if(currentField.isRequired()){ - text.add(new AttributeAppender("style",new Model("border:1px solid red;"),";")); - text.add(new AttributeAppender("required",new Model("required"),";")); - } - add(text); - text.add(new AttributeAppender("type",new Model(currentField.getDataType()),";")); - text.add(new AttributeAppender("id",new Model(currentField.getName()),";")); - } - - } - //发送有邮件方法 - public void sendMail(String getUserByLoginName,String sendEmail){ - Session sendMailSession = null; + public NewDataFormPanel(String id, IModel model) { + super(id, model); + } + + private class TextFragment extends Fragment { + + public TextFragment(String id, String markupId, + MarkupContainer markupProvider, String label) { + super(id, markupId, markupProvider); + add(new Label("celldata", label)); + // TODO Auto-generated constructor stub + } + } + + private class LayoutFragment extends Fragment { + + public LayoutFragment(String id, String markupId, + MarkupContainer markupProvider, String label) { + super(id, markupId, markupProvider); + add(new Label("add", label)); + // TODO Auto-generated constructor stub + } + } + + private class DropDownChoiceFragment extends Fragment { + + public DropDownChoiceFragment(String id, String markupId, + MarkupContainer markupProvider, final List ids, + final Map list, IModel model) { + super(id, markupId, markupProvider); + + add(new DropDownChoice("dropDownInput", model, ids, + new IChoiceRenderer() { + @Override + public Object getDisplayValue(Long id) { + // TODO Auto-generated method stub + return list.get(id); + } + + @Override + public String getIdValue(Long id, int index) { + return String.valueOf(id); + } + })); + } + } + + private class Textarea extends Fragment { + + public Textarea(String id, String markupId, MarkupContainer markupProvider, IModel model) { + super(id, markupId, markupProvider); + // TODO Auto-generated constructor stub + add(new TextArea("address", model)); + } + } + + private class RelationTableSearchFragment extends Fragment { + + public RelationTableSearchFragment(String id, String markupId, + MarkupContainer markupProvider, final String entityName, final String value, IModel model) { + super(id, markupId, markupProvider); + + PageParameters params = new PageParameters(); + params.set("en", entityName); + params.set("target", (long) model.getObject()); + PopupSettings popupSettings = new PopupSettings("查找").setHeight(470) + .setWidth(850).setLeft(150).setTop(200); + add(new BookmarkablePageLink("search_btn", SelectEntryPage.class, params).setPopupSettings(popupSettings)); + HiddenField hidden = new HiddenField("selected_id_hidden", model); + hidden.add(new AttributeAppender("id", entityName + "_id")); + add(hidden); + TextField text = new TextField("selected_value_input", new Model(value)); + text.add(new AttributeAppender("id", entityName + "_name")); + add(text); + } + } + + private class TextInputFragment extends Fragment { + + public TextInputFragment(String id, String markupId, + MarkupContainer markupProvider, IModel model, Field currentField) { + super(id, markupId, markupProvider); + TextField text = new TextField("input", model); + if (!currentField.isEditable()) { + Calendar calendar = Calendar.getInstance(); + SimpleDateFormat dateformat = new SimpleDateFormat("YYYY-MM-dd HH:mm"); + Date time = (Date) calendar.getTime(); + if (currentField.getName().equals("accountId")) { + add(text); + } else { + if (currentField.getName().equals("modify_datetime")) { + String modify_datetime = dateformat.format(time); + text.add(new AttributeAppender("value", new Model(modify_datetime), ";")); + } else if (currentField.getName().equals("whenadded")) { + String whenadded = dateformat.format(time); + text.add(new AttributeAppender("value", new Model(whenadded), ";")); + } else { + text.add(new AttributeAppender("value", new Model(user), ";")); + } + + } + text.add(new AttributeAppender("readonly", new Model("realonly"), ";")); + } + if (currentField.getDataType().equals("tel") || currentField.getName().equals("fax") || currentField.getName().equals("office_fax")) { + text.add(new AttributeAppender("pattern", new Model("^((\\d{11})|^((\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1})|(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1}))$)"), ";")); + } + if (currentField.isRequired()) { + text.add(new AttributeAppender("style", new Model("border:1px solid red;"), ";")); + text.add(new AttributeAppender("required", new Model("required"), ";")); + } + add(text); + text.add(new AttributeAppender("type", new Model(currentField.getDataType()), ";")); + text.add(new AttributeAppender("id", new Model(currentField.getName()), ";")); + } + } + //发送有邮件方法 + + public void sendMail(String getUserByLoginName, String sendEmail) { + Session sendMailSession = null; SMTPTransport transport = null; StringBuilder emailContent = new StringBuilder("请点击连接激活用户:"); Properties systemPeroperties = new Properties(); try { - systemPeroperties.load(NewDataFormPanel.class.getResourceAsStream("/system.properties")); - } catch (FileNotFoundException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } + systemPeroperties.load(NewDataFormPanel.class.getResourceAsStream("/system.properties")); + } catch (FileNotFoundException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } emailContent.append(systemPeroperties.getProperty("http")); emailContent.append(systemPeroperties.getProperty("url")); emailContent.append("/"); @@ -393,19 +393,19 @@ public void sendMail(String getUserByLoginName,String sendEmail){ sendMailSession = Session.getInstance(props, auth); // 建立连接。 // SMTPTransport用来发送邮件。 try { - transport = (SMTPTransport) sendMailSession.getTransport("smtp"); - transport.connect(); - // 创建邮件。 - Message newMessage = new MimeMessage(sendMailSession); - newMessage.setFrom(new InternetAddress("accpcui@163.com")); - newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(sendEmail)); - newMessage.setSubject("用户激活!"); - newMessage.setSentDate(new Date()); - newMessage.setText(emailContent.toString()); - Transport.send(newMessage); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } + transport = (SMTPTransport) sendMailSession.getTransport("smtp"); + transport.connect(); + // 创建邮件。 + Message newMessage = new MimeMessage(sendMailSession); + newMessage.setFrom(new InternetAddress("accpcui@163.com")); + newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(sendEmail)); + newMessage.setSubject("用户激活!"); + newMessage.setSentDate(new Date()); + newMessage.setText(emailContent.toString()); + Transport.send(newMessage); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } } diff --git a/crm/src/main/webapp/css/extra.css b/crm/src/main/webapp/css/extra.css index 901cd70..d5f589f 100644 --- a/crm/src/main/webapp/css/extra.css +++ b/crm/src/main/webapp/css/extra.css @@ -36,8 +36,6 @@ a:hover, a:focus { padding-top: 3px; } .detailed { - background: #eee; - padding-bottom: 20px; } .collapse{ background: #fff; @@ -49,6 +47,15 @@ a:hover, a:focus { text-align: right; padding-right: 10px; } +.table-column-view { + float: left; + width: 140px; + text-align: left; + padding-right: 10px; +} +.table-column-view .tag{ + width: 150px; +} .table-cell { display: inline-block; border-bottom: solid; @@ -72,6 +79,7 @@ a:hover, a:focus { } .tag{ width: 130px; + text-align: right; } @media ( max-width : 767px) { /* Enable use of floated navbar text */ @@ -165,7 +173,7 @@ a:hover, a:focus { @media ( max-width : 440px) { .table-column { float: left; - text-align: left; + text-align: left !important; width: 100%; } .form_datetime > input { @@ -181,4 +189,7 @@ a:hover, a:focus { .form_datetime { padding-right: 12px; } + .table-column-view { + width: 100px; + } } \ No newline at end of file From 4c44a14e56082fd33fe7995a6c2d7c5ba860416f Mon Sep 17 00:00:00 2001 From: DongJingChao <447958999@qq.com> Date: Tue, 22 Oct 2013 15:10:54 +0800 Subject: [PATCH 036/520] modify create activity jump function --- .../java/com/rex/crm/CreateEventPage.java | 280 +++++++++++++----- .../java/com/rex/crm/EventEditorPage.java | 10 +- .../java/com/rex/crm/EventViewerPage.java | 2 +- .../java/com/rex/crm/common/CRUDPanel.java | 2 +- .../com/rex/crm/common/CalendarPanel.java | 2 - .../com/rex/crm/common/EditDataFormPanel.html | 38 +-- .../com/rex/crm/common/EditDataFormPanel.java | 28 +- crm/src/main/resources/entity.xml | 6 +- 8 files changed, 254 insertions(+), 114 deletions(-) diff --git a/crm/src/main/java/com/rex/crm/CreateEventPage.java b/crm/src/main/java/com/rex/crm/CreateEventPage.java index 06af1a2..bcd82b5 100644 --- a/crm/src/main/java/com/rex/crm/CreateEventPage.java +++ b/crm/src/main/java/com/rex/crm/CreateEventPage.java @@ -74,8 +74,6 @@ public class CreateEventPage extends TemplatePage */ public CreateEventPage() { - - Map entities = Configuration.getEntityTable(); Entity entity = entities.get("activity"); setPageTitle(entity.getDisplay()); @@ -95,7 +93,6 @@ protected void onSubmit() String st = getRequest().getPostParameters().getParameterValue("start_time").toString(); String ed = getRequest().getPostParameters().getParameterValue("end_date").toString(); String et = getRequest().getPostParameters().getParameterValue("end_time").toString(); - //String visit_type = getRequest().getPostParameters().getParameterValue("visit_type").toString(); String visit_type = String.valueOf(activity_type); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); String sdt = sd+ " " +st; @@ -110,12 +107,6 @@ protected void onSubmit() // TODO Auto-generated catch block e.printStackTrace(); } - logger.debug(String.format("time info %s %s %s %s", sd,st,ed,et)); - logger.debug("event_type:"+ event_type); - logger.debug("contact id:"+ hidden_contact_select); - logger.debug("visit_type:" + visit_type); - logger.debug("usersereaser:" + user); - logger.debug("hidden_select_user: "+ hidden_select_user); if(null==hidden_contact_select){ contactId = 0; }else{ @@ -161,13 +152,11 @@ protected void onSubmit() } } } catch (NumberFormatException e) { - // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { - // TODO Auto-generated catch block e.printStackTrace(); } - setResponsePage(PageFactory.createPage("calendar")); + setResponsePage(PageFactory.createPage("calendar")); } }; add(form); @@ -192,27 +181,19 @@ protected void onSubmit() form.add(location); //分数 TextField total_score = new TextField("total_score", new PropertyModel(this,"total_score")); - //total_score.add(new AttributeAppender("type",new Model(Filed.getDataType()),";")); form.add(total_score); - TextField planing = new TextField("planing", new PropertyModel(this,"planing")); form.add(planing); - TextField openling = new TextField("openling", new PropertyModel(this,"openling")); form.add(openling); - TextField enquery_listening = new TextField("enquery_listening", new PropertyModel(this,"enquery_listening")); form.add(enquery_listening); - TextField deliverable = new TextField("deliverable", new PropertyModel(this,"deliverable")); form.add(deliverable); - TextField objection_handing = new TextField("objection_handing", new PropertyModel(this,"objection_handing")); form.add(objection_handing); - TextField summary = new TextField("summary", new PropertyModel(this,"summary")); form.add(summary); - StringValue startdateValue = this.getRequest().getRequestParameters().getParameterValue("startdate"); String startdate = null; @@ -225,66 +206,37 @@ protected void onSubmit() }else{ startdate = dateformat.format(current_date_time); } - logger.debug("startdate:"+startdate); - - - - WebMarkupContainer start_date_input = new WebMarkupContainer("start_date_input"); - //startDate = startdate; - //DateTextField start_date_input = new DateTextField("start_date_input", new PropertyModel(this,"startDate")); form.add(start_date_input); start_date_input.add(new AttributeModifier("value",startdate)); - SimpleDateFormat timeformatter = new SimpleDateFormat("HH:mm"); WebMarkupContainer start_time_input = new WebMarkupContainer("start_time_input"); form.add(start_time_input); start_time_input.add(new AttributeModifier("value",timeformatter.format(current_date_time))); - SimpleDateFormat dateformat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - Date sDate = current_date_time; try { sDate = dateformat2.parse(startdate+ " " + timeformatter.format(current_date_time)); } catch (ParseException e) { - // TODO Auto-generated catch block logger.warn("failed to parse date:",e); } - - Date next_date_time = new Date(sDate.getTime()+3600*1000); WebMarkupContainer end_date_input = new WebMarkupContainer("end_date_input"); form.add(end_date_input); end_date_input.add(new AttributeModifier("value",dateformat.format(next_date_time))); - - - - WebMarkupContainer end_time_input = new WebMarkupContainer("end_time_input",new Model("")); form.add(end_time_input); end_time_input.add(new AttributeModifier("value",timeformatter.format(next_date_time))); - - - PopupSettings popupSettings = new PopupSettings("查找").setHeight(470) - .setWidth(850).setLeft(150).setTop(200); + PopupSettings popupSettings = new PopupSettings("查找").setHeight(470).setWidth(850).setLeft(150).setTop(200); form.add(new BookmarkablePageLink("search_btn", SearchContactPage.class).setPopupSettings(popupSettings)); - - form.add(new HiddenField("hidden_contact_select" ,new PropertyModel(this,"hidden_contact_select"))); form.add(new TextField("contact_select", new Model(""))); - - PageParameters params = new PageParameters(); params.set("mid", uid); logger.debug("uid:"+uid); form.add(new BookmarkablePageLink("search_user_btn", SelectCRMUserPage.class,params).setPopupSettings(popupSettings)); form.add(new HiddenField("hidden_select_user" ,new PropertyModel(this,"hidden_select_user"))); form.add(new TextField("selected_user" ,new PropertyModel(this,"selected_user"))); - - //final List sales_visiting_purpose_pl = DAOImpl.queryPickList("sales_visiting_purpose_pl"); - //final List com_visiting_purpose_pl = DAOImpl.queryPickList("com_visiting_purpose_pl"); - - IModel visiting_purpose_choices_model = new AbstractReadOnlyModel() { @Override @@ -292,39 +244,23 @@ public List getObject() { List choices = new ArrayList(); return DAOImpl.queryPickListByFilter("activity_visiting_purpose_pl", "activity_type", String.valueOf(activity_type.getId())); } - }; - //visiting purpose choice final DropDownChoice visiting_purpose_choice = createDropDownListFromPickList("visiting_purpose_input","com_visiting_purpose_pl",visiting_purpose_choices_model,new PropertyModel(this,"visiting_purpose")); visiting_purpose_choice.setOutputMarkupId(true); form.add(visiting_purpose_choice); - //event type choice DropDownChoice activity_type_choice = createDropDownListFromPickList("activity_type_input","activity_activity_types_pl",null,new PropertyModel(this,"activity_type")); activity_type_choice.setOutputMarkupId(true); form.add(activity_type_choice); - activity_type_choice.add(new AjaxFormComponentUpdatingBehavior("onchange") { - private static final long serialVersionUID = 1L; - @Override protected void onUpdate(AjaxRequestTarget target) { - -// if(activity_type.getId() == 1L){ -// -// visiting_purpose_choice.setChoices(com_visiting_purpose_pl); -// }else{ -// -// visiting_purpose_choice.setChoices(sales_visiting_purpose_pl); -// } target.add(visiting_purpose_choice); } }); - - //set event type RadioGroup event_type_group=new RadioGroup("event_type_group",new PropertyModel(this,"event_type")); event_type_group.add(new Radio("radio1", new Model(1L))); @@ -334,41 +270,229 @@ protected void onUpdate(AjaxRequestTarget target) { } event_type_group.add(coachingRadio); form.add(event_type_group); - - - form.add(createDropDownListFromPickList("feature_product_input","activity_feature_product_pl",null,new PropertyModel(this,"feature_product"))); form.add(new TextField("act_title_input", new PropertyModel(this,"act_title_input"))); //拜访辅导。辅导者,状态, - } - - + public CreateEventPage(final int type) + { + Map entities = Configuration.getEntityTable(); + Entity entity = entities.get("activity"); + setPageTitle(entity.getDisplay()); + final String uid = ((SignIn2Session)getSession()).getUserId(); + final String user = ((SignIn2Session)getSession()).getUser(); + final int roleId = ((SignIn2Session)getSession()).getRoleId(); + CRMUser crmUser = DAOImpl.getCRMUserInfoById(Integer.parseInt(uid)); + //辅导名称拼接字段 + final StringBuffer concahName = new StringBuffer(); + concahName.append(crmUser.getName()); + Form form = new Form("form"){ + @Override + protected void onSubmit() + { + logger.debug("this form was submitted!"); + String sd = getRequest().getPostParameters().getParameterValue("start_date").toString(); + String st = getRequest().getPostParameters().getParameterValue("start_time").toString(); + String ed = getRequest().getPostParameters().getParameterValue("end_date").toString(); + String et = getRequest().getPostParameters().getParameterValue("end_time").toString(); + String visit_type = String.valueOf(activity_type); + SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + String sdt = sd+ " " +st; + String edt = ed + " " + et; + int contactId = 0; + Date startdt = null; + Date enddt = null; + try { + startdt = dateformat.parse(sdt); + enddt = dateformat.parse(edt); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if(null==hidden_contact_select){ + contactId = 0; + }else{ + contactId = Integer.parseInt(hidden_contact_select); + } + try { + + int crmuserId = 0; + String participants = user; + if(event_type == 1){ + //visiting + crmuserId = Integer.parseInt(uid); + + }else if(event_type == 2){ + //coaching + crmuserId = Integer.parseInt(uid);; + participants = participants+ ", "+ selected_user; + concahName.append(sd); + hidden_contact_select = "0"; + contactId = -1; + concahName.append("拜访辅导"); + } + //insert the event, and return the generated id of the event + long generatedkey = DAOImpl.addCalendarEventForCoach(crmuserId, contactId,String.valueOf(activity_type.getId()), + concahName.toString(), String.valueOf(startdt.getTime()/1000), + String.valueOf(enddt.getTime()/1000),1,user,user,user, + String.valueOf(visiting_purpose.getId()), + String.valueOf(feature_product.getId()),event_type.intValue(),participants, + coach,location,total_score,planing,openling,enquery_listening,deliverable,objection_handing,summary); + logger.debug("generatedkey:"+ generatedkey); + if(generatedkey>0){ + if(event_type == 1){ + //if it is a visiting, we only send this event to the owner; + DAOImpl.insert2UserRelationTable("activity",uid,String.valueOf(generatedkey)); + }else if(event_type == 2){ + //if it is a coaching, we need send this event to the manager and sales + //add new record for the manager + logger.debug("key:"+String.valueOf(generatedkey)); + DAOImpl.insert2UserRelationTable("activity",uid,String.valueOf(generatedkey)); + //add new record for the sales + DAOImpl.insert2UserRelationTable("activity",hidden_select_user,String.valueOf(generatedkey)); + } + } + } catch (NumberFormatException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + setResponsePage(new ActivityPage()); + } + }; + add(form); + //辅导者 + TextField coach = new TextField("coach", new PropertyModel(this,"coach")); + coach.add(new AttributeAppender("value",crmUser.getName())); + form.add(coach); + //创建人 + TextField owner = new TextField("owner", new PropertyModel(this,"owner")); + owner.add(new AttributeAppender("value",crmUser.getName())); + form.add(owner); + //创建时间 + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 + TextField whenadded = new TextField("whenadded", new PropertyModel(this,"whenadded")); + whenadded.add(new AttributeAppender("value",df.format(new Date()))); + form.add(whenadded); + //状态默认为计划中 + TextField status = new TextField("status", new PropertyModel(this,"status")); + form.add(status); + //计划地点 + TextField location = new TextField("location", new PropertyModel(this,"location")); + form.add(location); + //分数 + TextField total_score = new TextField("total_score", new PropertyModel(this,"total_score")); + form.add(total_score); + TextField planing = new TextField("planing", new PropertyModel(this,"planing")); + form.add(planing); + TextField openling = new TextField("openling", new PropertyModel(this,"openling")); + form.add(openling); + TextField enquery_listening = new TextField("enquery_listening", new PropertyModel(this,"enquery_listening")); + form.add(enquery_listening); + TextField deliverable = new TextField("deliverable", new PropertyModel(this,"deliverable")); + form.add(deliverable); + TextField objection_handing = new TextField("objection_handing", new PropertyModel(this,"objection_handing")); + form.add(objection_handing); + TextField summary = new TextField("summary", new PropertyModel(this,"summary")); + form.add(summary); + StringValue startdateValue = this.getRequest().getRequestParameters().getParameterValue("startdate"); + + String startdate = null; + long current = System.currentTimeMillis(); + Date current_date_time = new Date(current); + SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); + //set default time to current time + if(startdateValue != null && !startdateValue.isEmpty() && !startdateValue.isNull()){ + startdate = startdateValue.toString(); + }else{ + startdate = dateformat.format(current_date_time); + } + WebMarkupContainer start_date_input = new WebMarkupContainer("start_date_input"); + form.add(start_date_input); + start_date_input.add(new AttributeModifier("value",startdate)); + SimpleDateFormat timeformatter = new SimpleDateFormat("HH:mm"); + WebMarkupContainer start_time_input = new WebMarkupContainer("start_time_input"); + form.add(start_time_input); + start_time_input.add(new AttributeModifier("value",timeformatter.format(current_date_time))); + SimpleDateFormat dateformat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + Date sDate = current_date_time; + try { + sDate = dateformat2.parse(startdate+ " " + timeformatter.format(current_date_time)); + } catch (ParseException e) { + logger.warn("failed to parse date:",e); + } + Date next_date_time = new Date(sDate.getTime()+3600*1000); + WebMarkupContainer end_date_input = new WebMarkupContainer("end_date_input"); + form.add(end_date_input); + end_date_input.add(new AttributeModifier("value",dateformat.format(next_date_time))); + WebMarkupContainer end_time_input = new WebMarkupContainer("end_time_input",new Model("")); + form.add(end_time_input); + end_time_input.add(new AttributeModifier("value",timeformatter.format(next_date_time))); + PopupSettings popupSettings = new PopupSettings("查找").setHeight(470).setWidth(850).setLeft(150).setTop(200); + form.add(new BookmarkablePageLink("search_btn", SearchContactPage.class).setPopupSettings(popupSettings)); + form.add(new HiddenField("hidden_contact_select" ,new PropertyModel(this,"hidden_contact_select"))); + form.add(new TextField("contact_select", new Model(""))); + PageParameters params = new PageParameters(); + params.set("mid", uid); + form.add(new BookmarkablePageLink("search_user_btn", SelectCRMUserPage.class,params ).setPopupSettings(popupSettings)); + form.add(new HiddenField("hidden_select_user" ,new PropertyModel(this,"hidden_select_user"))); + form.add(new TextField("selected_user" ,new PropertyModel(this,"selected_user"))); + IModel visiting_purpose_choices_model = new AbstractReadOnlyModel() + { + @Override + public List getObject() { + List choices = new ArrayList(); + return DAOImpl.queryPickListByFilter("activity_visiting_purpose_pl", "activity_type", String.valueOf(activity_type.getId())); + } + }; + //visiting purpose choice + final DropDownChoice visiting_purpose_choice = createDropDownListFromPickList("visiting_purpose_input","com_visiting_purpose_pl",visiting_purpose_choices_model,new PropertyModel(this,"visiting_purpose")); + visiting_purpose_choice.setOutputMarkupId(true); + form.add(visiting_purpose_choice); + //event type choice + DropDownChoice activity_type_choice = createDropDownListFromPickList("activity_type_input","activity_activity_types_pl",null,new PropertyModel(this,"activity_type")); + activity_type_choice.setOutputMarkupId(true); + form.add(activity_type_choice); + activity_type_choice.add(new AjaxFormComponentUpdatingBehavior("onchange") + { + private static final long serialVersionUID = 1L; + @Override + protected void onUpdate(AjaxRequestTarget target) { + target.add(visiting_purpose_choice); + } + }); + //set event type + RadioGroup event_type_group=new RadioGroup("event_type_group",new PropertyModel(this,"event_type")); + event_type_group.add(new Radio("radio1", new Model(1L))); + Radio coachingRadio = new Radio("radio2", new Model(2L)); + if(roleId == 3){ + coachingRadio.add(new AttributeAppender("disabled","true")); + } + event_type_group.add(coachingRadio); + form.add(event_type_group); + form.add(createDropDownListFromPickList("feature_product_input","activity_feature_product_pl",null,new PropertyModel(this,"feature_product"))); + form.add(new TextField("act_title_input", new PropertyModel(this,"act_title_input"))); + //拜访辅导。辅导者,状态, + } private DropDownChoice createDropDownListFromPickList(String markupId, String picklistName,IModel choices,PropertyModel default_model){ - if(choices == null){ choices = Model.ofList(DAOImpl.queryPickList(picklistName)); } - return new DropDownChoice(markupId, default_model, choices, new IChoiceRenderer() { - @Override public Object getDisplayValue(Choice choice) { // TODO Auto-generated method stub return choice.getVal(); } - @Override public String getIdValue(Choice choice, int index) { // TODO Auto-generated method stub return String.valueOf(choice.getId()); } - }); } - class SelectOption implements Serializable{ private int key; private String value; diff --git a/crm/src/main/java/com/rex/crm/EventEditorPage.java b/crm/src/main/java/com/rex/crm/EventEditorPage.java index e14f28d..e1d6c8e 100644 --- a/crm/src/main/java/com/rex/crm/EventEditorPage.java +++ b/crm/src/main/java/com/rex/crm/EventEditorPage.java @@ -68,7 +68,7 @@ public class EventEditorPage extends TemplatePage { public EventEditorPage(final long eventId) { Map entities = Configuration.getEntityTable(); - Entity entity = entities.get("activity"); + final Entity entity = entities.get("activity"); setPageTitle(entity.getDisplay()); final String uid = ((SignIn2Session) getSession()).getUserId(); final String user = ((SignIn2Session) getSession()).getUser(); @@ -116,7 +116,6 @@ protected void onSubmit() { logger.debug("visit_type:" + visit_type); logger.debug("usersereaser:" + user); try { - DAOImpl.updateCalendarEvent(String.valueOf(eventId), hidden_contact_select, visit_type, act_title_input, startdt.getTime(), enddt.getTime(), 1, user, @@ -130,15 +129,12 @@ protected void onSubmit() { // TODO Auto-generated catch block e.printStackTrace(); } - - setResponsePage(PageFactory.createPage("calendar")); - + setResponsePage(new EventViewerPage(String.valueOf(eventId))); } }; add(form); - StringValue startdateValue = this.getRequest().getRequestParameters() - .getParameterValue("startdate"); + StringValue startdateValue = this.getRequest().getRequestParameters().getParameterValue("startdate"); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); Date startDate = new Date( diff --git a/crm/src/main/java/com/rex/crm/EventViewerPage.java b/crm/src/main/java/com/rex/crm/EventViewerPage.java index bff8a2c..0a748d4 100644 --- a/crm/src/main/java/com/rex/crm/EventViewerPage.java +++ b/crm/src/main/java/com/rex/crm/EventViewerPage.java @@ -203,7 +203,7 @@ protected void onSubmit() { //update status of calenderEvent mark it to be completed Date act_end_datetime = new Date(); - DAOImpl.updateStatusOfCalendarEvent((int)eventId, 2,act_end_datetime); + DAOImpl.updateStatusOfCalendarEvent((int)eventId,2,act_end_datetime); if(entity.getName().equals("activity")){ setResponsePage(new ActivityPage()); }else{ diff --git a/crm/src/main/java/com/rex/crm/common/CRUDPanel.java b/crm/src/main/java/com/rex/crm/common/CRUDPanel.java index 8ca352c..a0786b0 100644 --- a/crm/src/main/java/com/rex/crm/common/CRUDPanel.java +++ b/crm/src/main/java/com/rex/crm/common/CRUDPanel.java @@ -58,7 +58,7 @@ public CRUDPanel( final String id, final String entityName,final String entity @Override public void onClick() { if(entity.getName().equals("activity")){ - setResponsePage(new CreateEventPage()); + setResponsePage(new CreateEventPage(1)); }else{ setResponsePage(new CreateDataPage(entity.getName())); } diff --git a/crm/src/main/java/com/rex/crm/common/CalendarPanel.java b/crm/src/main/java/com/rex/crm/common/CalendarPanel.java index edf77f3..91d2049 100644 --- a/crm/src/main/java/com/rex/crm/common/CalendarPanel.java +++ b/crm/src/main/java/com/rex/crm/common/CalendarPanel.java @@ -67,8 +67,6 @@ public void renderHead(IHeaderResponse response) { } catch (IOException e) { e.printStackTrace(); } - - } diff --git a/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.html b/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.html index 3800420..bf534a2 100644 --- a/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.html +++ b/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.html @@ -33,22 +33,24 @@ - - - - - - - - - - - - - - - -    - - + + + + + + + + + + + + + + + + + +    + + diff --git a/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.java b/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.java index 4ce4374..03b8ca7 100644 --- a/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.java +++ b/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.java @@ -22,6 +22,7 @@ import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.HiddenField; import org.apache.wicket.markup.html.form.IChoiceRenderer; +import org.apache.wicket.markup.html.form.TextArea; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.link.BookmarkablePageLink; import org.apache.wicket.markup.html.link.PopupSettings; @@ -184,10 +185,18 @@ else if (currentField.getRelationTable() != null) { CRMUtility.formatValue(currentField.getFormatter(), String.valueOf(rawvalue)); value = (value == null) ? "" : value; - IModel textModel = new Model(""); - models.put(CRMUtility.formatValue(currentField.getFormatter(),String.valueOf(rawvalue)),textModel); - fieldNameToModel.put(currentField.getName(), textModel); - columnitem.add(new TextInputFragment("editdata","textInputFragment", this, textModel,value,currentField)); + + if(currentField.getName().equals("address")){ + IModel textModel = new Model(value); + models.put(CRMUtility.formatValue(currentField.getFormatter(),String.valueOf(rawvalue)),textModel); + fieldNameToModel.put(currentField.getName(), textModel); + columnitem.add(new Textarea("editdata","textAreaFragment", this, textModel)); + }else{ + IModel textModel = new Model(""); + models.put(CRMUtility.formatValue(currentField.getFormatter(),String.valueOf(rawvalue)),textModel); + fieldNameToModel.put(currentField.getName(), textModel); + columnitem.add(new TextInputFragment("editdata","textInputFragment", this, textModel,value,currentField)); + } } } columnRepeater.add(columnitem); @@ -291,6 +300,17 @@ public String getIdValue(Long id, int index) { } } +private class Textarea extends Fragment { + + public Textarea(String id, String markupId, MarkupContainer markupProvider,IModel value) + { + super(id, markupId, markupProvider); + // TODO Auto-generated constructor stub + add(new TextArea ("address",value)); + + } + +} private class TextInputFragment extends Fragment { public TextInputFragment(String id, String markupId, MarkupContainer markupProvider, IModel model,String value,Field currentField) { diff --git a/crm/src/main/resources/entity.xml b/crm/src/main/resources/entity.xml index 8c8d93d..73d2706 100644 --- a/crm/src/main/resources/entity.xml +++ b/crm/src/main/resources/entity.xml @@ -141,7 +141,7 @@ local_or_army - 地方医院/军队医院 + 地方/军队医院 false number false @@ -154,7 +154,7 @@ comprehensive_or_specialized - 综合医院/专科医院 + 综合/专科医院 false number false @@ -365,7 +365,7 @@ num_of_using_opiates_injection - 阿片类注射剂量(金额) + 阿片类注射剂量(¥) false text false From 8c2dd36c7a8a6a3e61361ddd8fc7cf7b24b6fdd4 Mon Sep 17 00:00:00 2001 From: MikeLee Date: Tue, 22 Oct 2013 15:53:59 +0800 Subject: [PATCH 037/520] Detail page delete & edit button altered Support responsive UI. --- .../java/com/rex/crm/common/CRUDPanel.html | 10 +- .../com/rex/crm/common/EntityDetailPage.html | 108 +++++++++--------- .../rex/crm/common/PageableTablePanel.html | 5 +- crm/src/main/webapp/css/extra.css | 22 ++++ 4 files changed, 83 insertions(+), 62 deletions(-) diff --git a/crm/src/main/java/com/rex/crm/common/CRUDPanel.html b/crm/src/main/java/com/rex/crm/common/CRUDPanel.html index 2768780..1697350 100644 --- a/crm/src/main/java/com/rex/crm/common/CRUDPanel.html +++ b/crm/src/main/java/com/rex/crm/common/CRUDPanel.html @@ -7,11 +7,11 @@ }); -
- - - - +
+
+
+
+
diff --git a/crm/src/main/java/com/rex/crm/common/EntityDetailPage.html b/crm/src/main/java/com/rex/crm/common/EntityDetailPage.html index 26373c6..cf686cd 100755 --- a/crm/src/main/java/com/rex/crm/common/EntityDetailPage.html +++ b/crm/src/main/java/com/rex/crm/common/EntityDetailPage.html @@ -1,60 +1,60 @@ - - - -
-
- -
-
- 我的 -
- [operation bar] -
-
-
-
-
-
-
-
-
-
-
- -
- -
-
-
-
+ +
+
+ +
+
+ 我的 +
+
[operation bar]
+
+
+
+
+
+
+
+
+
+
+
+ +
-
-
- -
-
-
- +
+
+
+
-
-
- - +
+
+ +
+
+
+ + +
+
+
+ diff --git a/crm/src/main/java/com/rex/crm/common/PageableTablePanel.html b/crm/src/main/java/com/rex/crm/common/PageableTablePanel.html index 7ebd259..bb916bb 100644 --- a/crm/src/main/java/com/rex/crm/common/PageableTablePanel.html +++ b/crm/src/main/java/com/rex/crm/common/PageableTablePanel.html @@ -24,12 +24,11 @@ diff --git a/crm/src/main/webapp/css/extra.css b/crm/src/main/webapp/css/extra.css index d5f589f..4570c9a 100644 --- a/crm/src/main/webapp/css/extra.css +++ b/crm/src/main/webapp/css/extra.css @@ -81,6 +81,10 @@ a:hover, a:focus { width: 130px; text-align: right; } +.btn-group-right{ + float: right; + padding-right: 10px; +} @media ( max-width : 767px) { /* Enable use of floated navbar text */ .btn.btn-sm.btn-danger.btn-mini { @@ -192,4 +196,22 @@ a:hover, a:focus { .table-column-view { width: 100px; } + .btn-group { + display: inline-block; + } + .full { + width: 100%; + } + .btn-group-right{ + width: 100%; + float: initial; + padding-top: 10px; + } + .btn-group-right a{ + width: 100%; + float: initial; + } + .pull-right div { + margin-right: 25px; + } } \ No newline at end of file From 9f0662ea41d1f3ffc6b82bd2653e781081f76615 Mon Sep 17 00:00:00 2001 From: MikeLee Date: Tue, 22 Oct 2013 16:19:38 +0800 Subject: [PATCH 038/520] UI minor change --- .../java/com/rex/crm/common/EditDataFormPanel.html | 2 +- crm/src/main/webapp/css/extra.css | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.html b/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.html index bf534a2..84a26e3 100644 --- a/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.html +++ b/crm/src/main/java/com/rex/crm/common/EditDataFormPanel.html @@ -17,7 +17,7 @@
-
+
diff --git a/crm/src/main/webapp/css/extra.css b/crm/src/main/webapp/css/extra.css index 4570c9a..99bedbe 100644 --- a/crm/src/main/webapp/css/extra.css +++ b/crm/src/main/webapp/css/extra.css @@ -180,15 +180,16 @@ a:hover, a:focus { text-align: left !important; width: 100%; } - .form_datetime > input { + .form_datetime input { width: 100%; } - .form_datetime > select { + .form_datetime select { width: 100%; } .table-cell { width: 100%; padding-right: 10px; + border: none; } .form_datetime { padding-right: 12px; @@ -214,4 +215,10 @@ a:hover, a:focus { .pull-right div { margin-right: 25px; } -} \ No newline at end of file + .controls input { + width: 100%; + } + .title > span{ + padding-left: 0px; + } +} From bfb5163b83f77a3da22639786a98a6199266e55c Mon Sep 17 00:00:00 2001 From: MikeLee Date: Tue, 22 Oct 2013 16:32:02 +0800 Subject: [PATCH 039/520] Special UI fix for Firefox --- crm/src/main/webapp/css/extra.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crm/src/main/webapp/css/extra.css b/crm/src/main/webapp/css/extra.css index 99bedbe..ecb680f 100644 --- a/crm/src/main/webapp/css/extra.css +++ b/crm/src/main/webapp/css/extra.css @@ -221,4 +221,9 @@ a:hover, a:focus { .title > span{ padding-left: 0px; } + @-moz-document url-prefix() { + .detailed { + margin-top: 90px; + } + } } From 6d762bcea4c69320db48296a6a1d2d994af05bc5 Mon Sep 17 00:00:00 2001 From: DongJingChao <447958999@qq.com> Date: Tue, 22 Oct 2013 17:21:46 +0800 Subject: [PATCH 040/520] modify datalist massageo --- .../com/rex/crm/common/EntityDetailPanel.java | 9 -------- .../rex/crm/common/PageableTablePanel.java | 16 ++++++++++---- .../java/com/rex/crm/common/TeamManPanel.java | 22 ++++++++++--------- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.java b/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.java index 86fb44e..02ab8d4 100644 --- a/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.java +++ b/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.java @@ -132,7 +132,6 @@ public EntityDetailPanel(String id, final Entity schema, final Map data, String String value = CRMUtility.formatValue(currentField.getFormatter(), DAOImpl.queryPickListByIdCached(currentField.getPicklist(), String.valueOf(data.get(currentField.getName())))); value = (value == null) ? "" : value; columnitem.add(new Label("celldata", value).setEscapeModelStrings(false)); -// columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); } } else if (currentField.getRelationTable() != null) { if (j % 2 == 0) { @@ -143,10 +142,8 @@ public EntityDetailPanel(String id, final Entity schema, final Map data, String value = (value == null) ? "" : value; if ((currentField.getName().equals("accountId"))) { columnitem.add(new DetailLinkFragment("celldata", "detailFragment", this, value)); -// columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); } else { columnitem.add(new Label("celldata", value).setEscapeModelStrings(false)); -// columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); } } } else { @@ -158,13 +155,7 @@ public EntityDetailPanel(String id, final Entity schema, final Map data, String rawvalue = (rawvalue == null) ? "" : rawvalue; String value = CRMUtility.formatValue(currentField.getFormatter(), String.valueOf(rawvalue)); value = (value == null) ? "" : value; -// if((currentField.getName().equals("accountId"))){ -// columnitem.add(new DetailLinkFragment("celldata", "detailFragment", this, value)); -// columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); -// }else{ columnitem.add(new Label("celldata", value).setEscapeModelStrings(false)); -// columnitem.add(new AttributeAppender("style", new Model("text-align:left;width:200px"), ";")); -// } } } columnRepeater.add(columnitem); diff --git a/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java b/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java index 1907f1a..ae02180 100644 --- a/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java +++ b/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java @@ -96,18 +96,30 @@ public Serializable getObject() { }); if (f.isDetailLink()) { String value = CRMUtility.formatValue(f.getFormatter(), String.valueOf(map.get(f.getName()))); + if(value.equals("null")||value.equals("")){ + value = "无"; + } columnitem.add(new DetailLinkFragment("celldata", "detailFragment", this.getParent().getParent(), value,entity)); // columnitem.add(new ButtonFragment("celldata","buttonFragment",this,"删除")); } else { if (f.getPicklist() != null) { // get option from picklist String value = CRMUtility.formatValue(f.getFormatter(), DAOImpl.queryPickListByIdCached(f.getPicklist(), String.valueOf(map.get(f.getName())))); + if(value.equals("null")||value.equals("")){ + value = "无"; + } columnitem.add(new Label("celldata", value)); } else if(f.getRelationTable() != null){ String value = CRMUtility.formatValue(f.getFormatter(), DAOImpl.queryCachedRelationDataById(f.getRelationTable(), String.valueOf(map.get(f.getName())))); + if(value.equals("null")||value.equals("")){ + value = "无"; + } columnitem.add(new Label("celldata", value)); }else { String value = CRMUtility.formatValue(f.getFormatter(), String.valueOf(map.get(f.getName()))); + if(value.equals("null")||value.equals("")){ + value = "无"; + } columnitem.add(new Label("celldata", value)); } } @@ -149,10 +161,6 @@ public DetailLinkFragment( String id, String markupId, MarkupContainer markupPro @Override public void onClick() { - // System.out.println(getParent().getId()); - // System.out.println("this link is clicked!"+this.getParent().getParent().getDefaultModelObject()); - // Account selected = - // (Account)getParent().getDefaultModelObject(); Param p = (Param) getParent().getParent().getDefaultModelObject(); logger.debug(p + " id:" + p.getId() + " name:" + p.getEntityName()); // Attribute att = new Attribute(); diff --git a/crm/src/main/java/com/rex/crm/common/TeamManPanel.java b/crm/src/main/java/com/rex/crm/common/TeamManPanel.java index dbfa9c3..223e3f2 100644 --- a/crm/src/main/java/com/rex/crm/common/TeamManPanel.java +++ b/crm/src/main/java/com/rex/crm/common/TeamManPanel.java @@ -146,28 +146,34 @@ public Serializable getObject() { if (f.isDetailLink()) { String value = CRMUtility.formatValue(f.getFormatter(), String.valueOf(map.get(f.getName()))); - //columnitem.add(new DetailLinkFragment("celldata", "detailFragment", this.getParent().getParent(), value)); -// columnitem.add(new ButtonFragment("celldata","buttonFragment",this,"删除")); + if(value.equals("null")||value.equals("")){ + value = "无"; + } columnitem.add(new DetailLinkFragment("celldata","detailFragment",this,value)); - - - } else { if (f.getPicklist() != null) { // get option from picklist String value = CRMUtility.formatValue(f.getFormatter(), DAOImpl.queryPickListByIdCached(f.getPicklist(), String.valueOf(map.get(f.getName())))); + if(value.equals("null")||value.equals("")){ + value = "无"; + } columnitem.add(new Label("celldata", value)); } else if(f.getRelationTable() != null){ String value = CRMUtility.formatValue(f.getFormatter(), DAOImpl.queryCachedRelationDataById(f.getRelationTable(), String.valueOf(map.get(f.getName())))); + if(value.equals("null")||value.equals("")){ + value = "无"; + } columnitem.add(new Label("celldata", value)); }else { String value = CRMUtility.formatValue(f.getFormatter(), String.valueOf(map.get(f.getName()))); + if(value.equals("null")||value.equals("")){ + value = "无"; + } columnitem.add(new Label("celldata", value)); } } columnRepeater.add(columnitem); } - //add extra field in the last column AbstractItem columnitem = new AbstractItem(columnRepeater.newChildId(), new Model(rowId)); if(roleId == 1){ @@ -179,13 +185,9 @@ public Serializable getObject() { columnRepeater.add(columnitem); } - - add(new NewDataFormPanel("formPanel",entity,null)); - } - public TeamManPanel(String id, IModel model) { super(id, model); } From a9c6c2ebeaf44c7942129b18ec6f465e7aa6e79a Mon Sep 17 00:00:00 2001 From: DongJingChao <447958999@qq.com> Date: Tue, 22 Oct 2013 17:46:10 +0800 Subject: [PATCH 041/520] done today tasks --- .../main/java/com/rex/crm/common/NewDataFormPanel.html | 2 +- .../main/java/com/rex/crm/common/PageableTablePanel.java | 9 ++++----- crm/src/main/java/com/rex/crm/common/TeamManPanel.java | 8 ++++---- crm/src/main/resources/entity.xml | 4 ++-- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.html b/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.html index 578c20e..46d2b14 100644 --- a/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.html +++ b/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.html @@ -50,7 +50,7 @@
- + diff --git a/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java b/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java index ae02180..4cb41c5 100644 --- a/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java +++ b/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java @@ -96,28 +96,27 @@ public Serializable getObject() { }); if (f.isDetailLink()) { String value = CRMUtility.formatValue(f.getFormatter(), String.valueOf(map.get(f.getName()))); - if(value.equals("null")||value.equals("")){ + if(value.equals("null")||value.equals("")||value.equals("dummy")){ value = "无"; } columnitem.add(new DetailLinkFragment("celldata", "detailFragment", this.getParent().getParent(), value,entity)); -// columnitem.add(new ButtonFragment("celldata","buttonFragment",this,"删除")); } else { if (f.getPicklist() != null) { // get option from picklist String value = CRMUtility.formatValue(f.getFormatter(), DAOImpl.queryPickListByIdCached(f.getPicklist(), String.valueOf(map.get(f.getName())))); - if(value.equals("null")||value.equals("")){ + if(value.equals("null")||value.equals("")||value.equals("dummy")){ value = "无"; } columnitem.add(new Label("celldata", value)); } else if(f.getRelationTable() != null){ String value = CRMUtility.formatValue(f.getFormatter(), DAOImpl.queryCachedRelationDataById(f.getRelationTable(), String.valueOf(map.get(f.getName())))); - if(value.equals("null")||value.equals("")){ + if(value.equals("null")||value.equals("")||value.equals("dummy")){ value = "无"; } columnitem.add(new Label("celldata", value)); }else { String value = CRMUtility.formatValue(f.getFormatter(), String.valueOf(map.get(f.getName()))); - if(value.equals("null")||value.equals("")){ + if(value.equals("null")||value.equals("")||value.equals("dummy")){ value = "无"; } columnitem.add(new Label("celldata", value)); diff --git a/crm/src/main/java/com/rex/crm/common/TeamManPanel.java b/crm/src/main/java/com/rex/crm/common/TeamManPanel.java index 223e3f2..f86089a 100644 --- a/crm/src/main/java/com/rex/crm/common/TeamManPanel.java +++ b/crm/src/main/java/com/rex/crm/common/TeamManPanel.java @@ -146,7 +146,7 @@ public Serializable getObject() { if (f.isDetailLink()) { String value = CRMUtility.formatValue(f.getFormatter(), String.valueOf(map.get(f.getName()))); - if(value.equals("null")||value.equals("")){ + if(value.equals("null")||value.equals("")||value.equals("dummy")){ value = "无"; } columnitem.add(new DetailLinkFragment("celldata","detailFragment",this,value)); @@ -154,19 +154,19 @@ public Serializable getObject() { if (f.getPicklist() != null) { // get option from picklist String value = CRMUtility.formatValue(f.getFormatter(), DAOImpl.queryPickListByIdCached(f.getPicklist(), String.valueOf(map.get(f.getName())))); - if(value.equals("null")||value.equals("")){ + if(value.equals("null")||value.equals("")||value.equals("dummy")){ value = "无"; } columnitem.add(new Label("celldata", value)); } else if(f.getRelationTable() != null){ String value = CRMUtility.formatValue(f.getFormatter(), DAOImpl.queryCachedRelationDataById(f.getRelationTable(), String.valueOf(map.get(f.getName())))); - if(value.equals("null")||value.equals("")){ + if(value.equals("null")||value.equals("")||value.equals("dummy")){ value = "无"; } columnitem.add(new Label("celldata", value)); }else { String value = CRMUtility.formatValue(f.getFormatter(), String.valueOf(map.get(f.getName()))); - if(value.equals("null")||value.equals("")){ + if(value.equals("null")||value.equals("")||value.equals("dummy")){ value = "无"; } columnitem.add(new Label("celldata", value)); diff --git a/crm/src/main/resources/entity.xml b/crm/src/main/resources/entity.xml index 73d2706..8fcdc59 100644 --- a/crm/src/main/resources/entity.xml +++ b/crm/src/main/resources/entity.xml @@ -1006,7 +1006,7 @@ email 邮箱 - true + false email false false @@ -1099,7 +1099,7 @@ email 邮箱 - false + true email false false From 8b75da9a144d2adf6cb31603af8dc4af1d5f2ee6 Mon Sep 17 00:00:00 2001 From: MikeLee Date: Tue, 22 Oct 2013 18:06:34 +0800 Subject: [PATCH 042/520] Table header altered --- .../rex/crm/common/PageableTablePanel.html | 131 ++++++++---------- .../rex/crm/common/PageableTablePanel.java | 6 + crm/src/main/webapp/css/extra.css | 39 +++++- 3 files changed, 102 insertions(+), 74 deletions(-) diff --git a/crm/src/main/java/com/rex/crm/common/PageableTablePanel.html b/crm/src/main/java/com/rex/crm/common/PageableTablePanel.html index bb916bb..af74868 100644 --- a/crm/src/main/java/com/rex/crm/common/PageableTablePanel.html +++ b/crm/src/main/java/com/rex/crm/common/PageableTablePanel.html @@ -1,78 +1,65 @@ - - -
-
-
-
-
-   我的 + 我的
- -    +
- - - - -
- 我的 - -
-
-
-
-
- - - - - - - - - - - - - - - - - - - -
- - - - - - + +
+
+
+
+
+
我的
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
- \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java b/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java index 1907f1a..41bdc9f 100644 --- a/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java +++ b/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java @@ -65,10 +65,15 @@ public PageableTablePanel(String id, final Entity entity, List mapList) { // set column name RepeatingView columnNameRepeater = new RepeatingView("columnNameRepeater"); datacontainer.add(columnNameRepeater); + int count=0; for (Field f : entity.getFields()) { if (!f.isVisible()|| f.getPriority() >1) continue; AbstractItem item = new AbstractItem(columnNameRepeater.newChildId()); + if(count==0){ + item.add(new AttributeAppender("class", new Model("table-first-link"), " ")); + count++; + } columnNameRepeater.add(item); item.add(new Label("columnName", f.getDisplay())); } @@ -97,6 +102,7 @@ public Serializable getObject() { if (f.isDetailLink()) { String value = CRMUtility.formatValue(f.getFormatter(), String.valueOf(map.get(f.getName()))); columnitem.add(new DetailLinkFragment("celldata", "detailFragment", this.getParent().getParent(), value,entity)); + columnitem.add(new AttributeAppender("class", new Model("table-first-link"), " ")); // columnitem.add(new ButtonFragment("celldata","buttonFragment",this,"删除")); } else { if (f.getPicklist() != null) { diff --git a/crm/src/main/webapp/css/extra.css b/crm/src/main/webapp/css/extra.css index ecb680f..8e48dd6 100644 --- a/crm/src/main/webapp/css/extra.css +++ b/crm/src/main/webapp/css/extra.css @@ -30,6 +30,10 @@ a:hover, a:focus { width: 217px; margin-right: 15px; } +.table-hide { + visibility: visible; + text-align: left; +} .title > span{ padding-left: 4px; display: inline-block; @@ -85,6 +89,22 @@ a:hover, a:focus { float: right; padding-right: 10px; } +.table-title{ + float: left; + font-size: 18px; + padding-left: 5px; + padding-top: 2px; +} +.table-custom-header{ + padding: 0; + width: 100%; + border-bottom: solid; + padding-bottom: 1px; + border-color: rgb(107, 166, 255); + box-sizing: border-box; + border-bottom-width: 2px; + height: 34px; +} @media ( max-width : 767px) { /* Enable use of floated navbar text */ .btn.btn-sm.btn-danger.btn-mini { @@ -146,7 +166,7 @@ a:hover, a:focus { padding-left: 9px; padding-right: 9px; display:block; - margin-right: 20px; + margin-right: 10px; } .btn.dropdown-toggle.clearfix.btn-info{ margin-right: 10px; @@ -221,9 +241,24 @@ a:hover, a:focus { .title > span{ padding-left: 0px; } + .table-custom-header{ + height: 74px; + } + .table-title{ + float: initial; + } + .operation-bar{ + float: initial; + } + .table-hide { + display: none; + } + .table-first-link{ + display: block + } @-moz-document url-prefix() { .detailed { margin-top: 90px; - } } } +} From f48c7d425a82f2f5d56a44fbaf4b109c708298f4 Mon Sep 17 00:00:00 2001 From: Feiyun Date: Tue, 22 Oct 2013 22:14:44 +0800 Subject: [PATCH 043/520] refactor code --- .../main/java/com/rex/crm/ActivityPage.java | 13 +-- .../main/java/com/rex/crm/CalendarPage.java | 1 - .../main/java/com/rex/crm/ContactPage.java | 1 - .../java/com/rex/crm/DealerAccountPage.html | 28 ------ .../java/com/rex/crm/DealerAccountPage.java | 65 ------------- .../java/com/rex/crm/DealerContactPage.html | 27 ------ .../java/com/rex/crm/DealerContactPage.java | 64 ------------ crm/src/main/java/com/rex/crm/HomePage.java | 1 - .../main/java/com/rex/crm/PageFactory.java | 4 - crm/src/main/java/com/rex/crm/UserPage.java | 1 - .../java/com/rex/crm/WicketApplication.java | 2 +- .../rex/crm/account/AccountDataProvider.java | 36 ------- .../rex/crm/account/AccountDetailPage.html | 64 ------------ .../rex/crm/account/AccountDetailPage.java | 93 ------------------ .../account/AccountListPanel$ActionPanel.html | 3 - .../com/rex/crm/account/AccountListPanel.html | 41 -------- .../com/rex/crm/account/AccountListPanel.java | 71 -------------- .../crm/account/DetachableAccountModel.java | 97 ------------------- .../java/com/rex/crm/common/CRUDPanel.java | 33 ++----- .../crm/common/DefaultCRUDActionListener.java | 21 ++++ .../com/rex/crm/common/EntityDetailPage.html | 5 +- .../com/rex/crm/common/EntityDetailPage.java | 43 +++++++- .../rex/crm/common/ICRUDActionListener.java | 8 ++ .../rex/crm/common/PageableTablePanel.java | 12 ++- .../com/rex/crm/common/TableDataPanel.java | 18 +++- .../java/com/rex/crm/common/TeamManPanel.java | 1 - .../rex/crm/common/UpdateDataFormPanel.html | 62 ------------ .../rex/crm/common/UpdateDataFormPanel.java | 77 --------------- .../rex/crm/reporter/ReportingTablePanel.java | 20 +--- .../com/rex/crm/user/CRMUserDataProvider.java | 1 - 30 files changed, 111 insertions(+), 802 deletions(-) delete mode 100755 crm/src/main/java/com/rex/crm/DealerAccountPage.html delete mode 100644 crm/src/main/java/com/rex/crm/DealerAccountPage.java delete mode 100755 crm/src/main/java/com/rex/crm/DealerContactPage.html delete mode 100644 crm/src/main/java/com/rex/crm/DealerContactPage.java delete mode 100644 crm/src/main/java/com/rex/crm/account/AccountDataProvider.java delete mode 100755 crm/src/main/java/com/rex/crm/account/AccountDetailPage.html delete mode 100644 crm/src/main/java/com/rex/crm/account/AccountDetailPage.java delete mode 100755 crm/src/main/java/com/rex/crm/account/AccountListPanel$ActionPanel.html delete mode 100644 crm/src/main/java/com/rex/crm/account/AccountListPanel.html delete mode 100644 crm/src/main/java/com/rex/crm/account/AccountListPanel.java delete mode 100755 crm/src/main/java/com/rex/crm/account/DetachableAccountModel.java create mode 100644 crm/src/main/java/com/rex/crm/common/DefaultCRUDActionListener.java create mode 100644 crm/src/main/java/com/rex/crm/common/ICRUDActionListener.java delete mode 100644 crm/src/main/java/com/rex/crm/common/UpdateDataFormPanel.html delete mode 100644 crm/src/main/java/com/rex/crm/common/UpdateDataFormPanel.java diff --git a/crm/src/main/java/com/rex/crm/ActivityPage.java b/crm/src/main/java/com/rex/crm/ActivityPage.java index b9da84a..29b4c51 100644 --- a/crm/src/main/java/com/rex/crm/ActivityPage.java +++ b/crm/src/main/java/com/rex/crm/ActivityPage.java @@ -4,23 +4,20 @@ import java.util.Map; import org.apache.commons.lang3.tuple.Pair; -import org.apache.wicket.markup.html.basic.Label; + import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.TextField; -import org.apache.wicket.markup.html.link.Link; -import org.apache.wicket.model.Model; + import org.apache.wicket.model.PropertyModel; import com.google.common.collect.Lists; -import com.rex.crm.account.AccountListPanel; -import com.rex.crm.common.CreateDataPage; + import com.rex.crm.common.Entity; -import com.rex.crm.common.EntityDetailPage; + import com.rex.crm.common.Field; import com.rex.crm.common.FilterPanel; import com.rex.crm.common.PageableTablePanel; -import com.rex.crm.common.Param; -import com.rex.crm.common.TableDataPanel; + import com.rex.crm.db.DAOImpl; import com.rex.crm.util.Configuration; diff --git a/crm/src/main/java/com/rex/crm/CalendarPage.java b/crm/src/main/java/com/rex/crm/CalendarPage.java index 4b8a00b..c1edd98 100644 --- a/crm/src/main/java/com/rex/crm/CalendarPage.java +++ b/crm/src/main/java/com/rex/crm/CalendarPage.java @@ -10,7 +10,6 @@ import org.apache.wicket.markup.html.internal.HtmlHeaderContainer; import org.apache.wicket.protocol.http.WebApplication; -import com.rex.crm.account.AccountListPanel; import com.rex.crm.common.CalendarPanel; import com.rex.crm.common.Entity; import com.rex.crm.common.TableDataPanel; diff --git a/crm/src/main/java/com/rex/crm/ContactPage.java b/crm/src/main/java/com/rex/crm/ContactPage.java index 768260d..888ad85 100644 --- a/crm/src/main/java/com/rex/crm/ContactPage.java +++ b/crm/src/main/java/com/rex/crm/ContactPage.java @@ -9,7 +9,6 @@ import org.apache.wicket.model.PropertyModel; import com.google.common.collect.Lists; -import com.rex.crm.account.AccountListPanel; import com.rex.crm.common.Entity; import com.rex.crm.common.Field; import com.rex.crm.common.FilterPanel; diff --git a/crm/src/main/java/com/rex/crm/DealerAccountPage.html b/crm/src/main/java/com/rex/crm/DealerAccountPage.html deleted file mode 100755 index d34a8a8..0000000 --- a/crm/src/main/java/com/rex/crm/DealerAccountPage.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - -
-
- -
-
-
- data table -
-
-
- -
- - diff --git a/crm/src/main/java/com/rex/crm/DealerAccountPage.java b/crm/src/main/java/com/rex/crm/DealerAccountPage.java deleted file mode 100644 index 93d2dd6..0000000 --- a/crm/src/main/java/com/rex/crm/DealerAccountPage.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.rex.crm; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.tuple.Pair; - -import com.google.common.collect.Lists; -import com.rex.crm.account.AccountListPanel; -import com.rex.crm.common.Entity; -import com.rex.crm.common.FilterPanel; -import com.rex.crm.common.PageableTablePanel; -import com.rex.crm.common.TableDataPanel; -import com.rex.crm.db.DAOImpl; -import com.rex.crm.util.Configuration; - - -/** - * @author Feiyun Zhou - */ -public class DealerAccountPage extends TemplatePage -{ - /** - * Constructor - */ - public DealerAccountPage() - { - initPage(null); - } - - - public DealerAccountPage(Map map){ - initPage(map); - } - - private void initPage(Map filter){ - Map entities = Configuration.getEntityTable(); - Entity entity = entities.get("dealerAccount"); - setPageTitle(entity.getDisplay()); - //List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); - //TODO get userId from request's session - String userId = "20"; - List mapList = null; - if(filter == null){ - mapList = DAOImpl.queryEntityRelationList(entity.getSql(), userId); - }else{ - - List ft = Lists.newArrayList(); - for (String k : filter.keySet()) { - if(filter.get(k)) ft.add(k); - } - mapList = DAOImpl.queryEntityWithFilter(entity.getSql(), entity.getFilterField(), ft, userId); - - - } - add(new PageableTablePanel("datalist",entity,mapList)); - - - //for the side bar - List>> types = DAOImpl.queryFilters(entity.getSql(), entity.getFilterField(), entity.getFieldByName(entity.getFilterField()).getPicklist(), userId); - add(new FilterPanel("filterPanel",types ,filter,DealerAccountPage.class)); - - } - -} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/DealerContactPage.html b/crm/src/main/java/com/rex/crm/DealerContactPage.html deleted file mode 100755 index 43b0658..0000000 --- a/crm/src/main/java/com/rex/crm/DealerContactPage.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - -
-
- -
-
-
- data table -
-
-
- -
- - diff --git a/crm/src/main/java/com/rex/crm/DealerContactPage.java b/crm/src/main/java/com/rex/crm/DealerContactPage.java deleted file mode 100644 index d43e4a9..0000000 --- a/crm/src/main/java/com/rex/crm/DealerContactPage.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.rex.crm; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.tuple.Pair; - -import com.google.common.collect.Lists; -import com.rex.crm.account.AccountListPanel; -import com.rex.crm.common.Entity; -import com.rex.crm.common.FilterPanel; -import com.rex.crm.common.PageableTablePanel; -import com.rex.crm.common.TableDataPanel; -import com.rex.crm.db.DAOImpl; -import com.rex.crm.util.Configuration; - - -/** - * @author Feiyun Zhou - */ -public class DealerContactPage extends TemplatePage -{ - /** - * Constructor - */ - public DealerContactPage() - { - initPage(null); - - } - - public DealerContactPage(Map map){ - initPage(map); - } - - private void initPage(Map filter){ - Map entities = Configuration.getEntityTable(); - Entity entity = entities.get("dealerContact"); - setPageTitle(entity.getDisplay()); - //List mapList = DAOImpl.queryEntityList(entity.getSql(), 0, 1000); - //TODO get userId from request's session - String userId = "20"; - List mapList = null; - if(filter == null){ - mapList = DAOImpl.queryEntityRelationList(entity.getSql(), userId); - }else{ - - List ft = Lists.newArrayList(); - for (String k : filter.keySet()) { - if(filter.get(k)) ft.add(k); - } - mapList = DAOImpl.queryEntityWithFilter(entity.getSql(), entity.getFilterField(), ft, userId); - - - } - add(new PageableTablePanel("datalist",entity,mapList)); - - - //for the side bar - List>> types = DAOImpl.queryFilters(entity.getSql(), entity.getFilterField(), entity.getFieldByName(entity.getFilterField()).getPicklist(), userId); - add(new FilterPanel("filterPanel",types ,filter,DealerContactPage.class)); - - } -} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/HomePage.java b/crm/src/main/java/com/rex/crm/HomePage.java index 1980748..461b38c 100644 --- a/crm/src/main/java/com/rex/crm/HomePage.java +++ b/crm/src/main/java/com/rex/crm/HomePage.java @@ -17,7 +17,6 @@ import org.apache.wicket.request.mapper.parameter.PageParameters; import com.google.common.collect.Maps; -import com.rex.crm.account.AccountListPanel; import com.rex.crm.common.CalendarPanel; import com.rex.crm.common.TeamManPanel; import com.rex.crm.common.CreateDataPage; diff --git a/crm/src/main/java/com/rex/crm/PageFactory.java b/crm/src/main/java/com/rex/crm/PageFactory.java index 76eecdf..bd01146 100644 --- a/crm/src/main/java/com/rex/crm/PageFactory.java +++ b/crm/src/main/java/com/rex/crm/PageFactory.java @@ -15,10 +15,6 @@ public static Page createPage(String name){ return new ActivityPage(); }else if(name.equalsIgnoreCase("crmuser")){ return new UserPage(); - }else if(name.equalsIgnoreCase("dealerAccount")){ - return new DealerAccountPage(); - }else if(name.equalsIgnoreCase("dealerContact")){ - return new DealerContactPage(); }else{ return new HomePage(); } diff --git a/crm/src/main/java/com/rex/crm/UserPage.java b/crm/src/main/java/com/rex/crm/UserPage.java index 1bb979a..b9b5b52 100644 --- a/crm/src/main/java/com/rex/crm/UserPage.java +++ b/crm/src/main/java/com/rex/crm/UserPage.java @@ -9,7 +9,6 @@ import org.apache.wicket.model.PropertyModel; import com.google.common.collect.Lists; -import com.rex.crm.account.AccountListPanel; import com.rex.crm.common.Entity; import com.rex.crm.common.Field; import com.rex.crm.common.FilterPanel; diff --git a/crm/src/main/java/com/rex/crm/WicketApplication.java b/crm/src/main/java/com/rex/crm/WicketApplication.java index dc26f7e..931bacf 100644 --- a/crm/src/main/java/com/rex/crm/WicketApplication.java +++ b/crm/src/main/java/com/rex/crm/WicketApplication.java @@ -31,7 +31,7 @@ public class WicketApplication extends WebApplication @Override public RuntimeConfigurationType getConfigurationType() { // TODO Auto-generated method stub - return RuntimeConfigurationType.DEPLOYMENT; + return RuntimeConfigurationType.DEVELOPMENT; } /** diff --git a/crm/src/main/java/com/rex/crm/account/AccountDataProvider.java b/crm/src/main/java/com/rex/crm/account/AccountDataProvider.java deleted file mode 100644 index e768c0c..0000000 --- a/crm/src/main/java/com/rex/crm/account/AccountDataProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.rex.crm.account; - -import java.util.Iterator; -import java.util.List; - -import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider; -import org.apache.wicket.model.IModel; - -import com.rex.crm.beans.Account; -import com.rex.crm.db.DAOImpl; - -public class AccountDataProvider extends SortableDataProvider { - - private int userId; - public AccountDataProvider(int userId){ - this.userId = userId; - } - - @Override - public Iterator iterator(long first, long count) { - // TODO Auto-generated method stub - List list = DAOImpl.getAccountsByUserId(userId); - return list.iterator(); - } - - @Override - public long size() { - return DAOImpl.getSizeOfAccountByUserId(userId); - } - - @Override - public IModel model(Account object) { - return new DetachableAccountModel(object); - } - -} diff --git a/crm/src/main/java/com/rex/crm/account/AccountDetailPage.html b/crm/src/main/java/com/rex/crm/account/AccountDetailPage.html deleted file mode 100755 index 79becfb..0000000 --- a/crm/src/main/java/com/rex/crm/account/AccountDetailPage.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - -
-
-
- [operation bar] -
-
-
    -
  • -
- - -
-
- [operation bar] -
-
- - - - - - - - - - - - - - - - - - -
姓名电话部门职位邮箱
-
-
-
-
-
- -
- - diff --git a/crm/src/main/java/com/rex/crm/account/AccountDetailPage.java b/crm/src/main/java/com/rex/crm/account/AccountDetailPage.java deleted file mode 100644 index 29c1a8c..0000000 --- a/crm/src/main/java/com/rex/crm/account/AccountDetailPage.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.rex.crm.account; - -import java.lang.reflect.InvocationTargetException; -import java.util.EnumSet; -import java.util.List; -import java.util.Map; - -import org.apache.commons.beanutils.BeanUtils; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.markup.repeater.RepeatingView; -import org.apache.wicket.markup.repeater.data.DataView; - -import com.rex.crm.TemplatePage; -import com.rex.crm.beans.Account; -import com.rex.crm.beans.CRMUser; -import com.rex.crm.common.CRUDPanel; -import com.rex.crm.db.DAOImpl; -import com.rex.crm.user.CRMUserDataProvider; - -/** - * @author Feiyun Zhou - */ -public class AccountDetailPage extends TemplatePage { - - public AccountDetailPage(String accountId){ - Account account = DAOImpl.getAccountById(Integer.parseInt(accountId)); - initPage(account); - } - - public AccountDetailPage(Account account) { - setPageTitle("客户"); - initPage(account); - } - - private void initPage(Account account){ - //TODO Get permission infor of user from database. - add(new CRUDPanel("operationBar","account",null,EnumSet.of(CRUDPanel.Permissions.DEL,CRUDPanel.Permissions.EDIT))); - - List filedsName = account.getFieldNames(); - Map fieldMap = account.getMappingOfField2ColumnName(); - - RepeatingView rv = new RepeatingView("entityDetail"); - add(rv); - - for (String name : filedsName) { - if (fieldMap.get(name) != null) { - WebMarkupContainer item = new WebMarkupContainer(rv.newChildId()); - rv.add(item); - Label label = null; - try { - label = new Label("caption", fieldMap.get(name) + ": " + BeanUtils.getProperty(account, name)); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - item.add(label); - } - } - - - - DataView dataView = new DataView("team-pageable", new CRMUserDataProvider(account.getId())) { - private static final long serialVersionUID = 1L; - - @Override - protected void populateItem(Item item) { - CRMUser user = item.getModelObject(); - item.add(new Label("name", user.getName())); - item.add(new Label("cellphone", user.getCellPhone())); - item.add(new Label("division", user.getDivision())); - item.add(new Label("jobtitle", user.getJobTitle())); - item.add(new Label("email", user.getEmail())); - - } - - - }; - dataView.setItemsPerPage(10000L); - add(dataView); - - //TODO Get permission info of user from database. - add(new CRUDPanel("team-operationBar","account",null,EnumSet.of(CRUDPanel.Permissions.ADD))); - - } -} \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/account/AccountListPanel$ActionPanel.html b/crm/src/main/java/com/rex/crm/account/AccountListPanel$ActionPanel.html deleted file mode 100755 index 7a34b2f..0000000 --- a/crm/src/main/java/com/rex/crm/account/AccountListPanel$ActionPanel.html +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/crm/src/main/java/com/rex/crm/account/AccountListPanel.html b/crm/src/main/java/com/rex/crm/account/AccountListPanel.html deleted file mode 100644 index a67f147..0000000 --- a/crm/src/main/java/com/rex/crm/account/AccountListPanel.html +++ /dev/null @@ -1,41 +0,0 @@ - -
-
- [operation bar] -
-
- - - - - - - - - - - - - - - - -
名称地址电话级别
-
-
- - - -
\ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/account/AccountListPanel.java b/crm/src/main/java/com/rex/crm/account/AccountListPanel.java deleted file mode 100644 index 2e4bc17..0000000 --- a/crm/src/main/java/com/rex/crm/account/AccountListPanel.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.rex.crm.account; - -import java.util.EnumSet; - -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.link.Link; -import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.markup.repeater.data.DataView; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; - -import com.rex.crm.beans.Account; -import com.rex.crm.common.CRUDPanel; - -public class AccountListPanel extends Panel { - private static final long serialVersionUID = 2501105233172820074L; - - public AccountListPanel(String id) { - super(id); - - DataView dataView = new DataView("pageable", new AccountDataProvider(20)) { - private static final long serialVersionUID = 1L; - - @Override - protected void populateItem(Item item) { - Account account = item.getModelObject(); - item.add(new ActionPanel("name",item.getModel(),account.getName())); - item.add(new Label("address", account.getAddress())); - item.add(new Label("tele", account.getTele())); - item.add(new Label("classification", account.getClassification())); - } - }; - dataView.setItemsPerPage(10000L); - add(dataView); - - //TODO Get permission info of user from database. - add(new CRUDPanel("operationBar","account",null,EnumSet.of(CRUDPanel.Permissions.DEL,CRUDPanel.Permissions.ADD,CRUDPanel.Permissions.EDIT))); - - } - - public AccountListPanel(String id, IModel model) { - super(id, model); - } - - class ActionPanel extends Panel - { - /** - * @param id - * component id - * @param model - * model for contact - */ - public ActionPanel(String id, IModel model,String name) - { - super(id, model); - add(new Link("select") - { - - @Override - public void onClick() - { - Account selected = (Account)getParent().getDefaultModelObject(); - setResponsePage(new AccountDetailPage(selected)); - } - }.add(new Label("label", new Model(name))) - ); - } - } - -} diff --git a/crm/src/main/java/com/rex/crm/account/DetachableAccountModel.java b/crm/src/main/java/com/rex/crm/account/DetachableAccountModel.java deleted file mode 100755 index 3c16572..0000000 --- a/crm/src/main/java/com/rex/crm/account/DetachableAccountModel.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.rex.crm.account; - -import org.apache.wicket.model.LoadableDetachableModel; - -import com.rex.crm.beans.Account; -import com.rex.crm.db.DAOImpl; - -/** - * detachable model for an instance of contact - * - * @author igor - * - */ -public class DetachableAccountModel extends LoadableDetachableModel -{ - private final int id; - - - /** - * @param c - */ - public DetachableAccountModel(Account a) - { - this(a.getId()); - } - - /** - * @param id - */ - public DetachableAccountModel(int id) - { - if (id == 0) - { - throw new IllegalArgumentException(); - } - this.id = id; - } - - /** - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() - { - return Long.valueOf(id).hashCode(); - } - - /** - * used for dataview with ReuseIfModelsEqualStrategy item reuse strategy - * - * @see org.apache.wicket.markup.repeater.ReuseIfModelsEqualStrategy - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object obj) - { - if (obj == this) - { - return true; - } - else if (obj == null) - { - return false; - } - else if (obj instanceof DetachableAccountModel) - { - DetachableAccountModel other = (DetachableAccountModel)obj; - return other.id == id; - } - return false; - } - - /** - * @see org.apache.wicket.model.LoadableDetachableModel#load() - */ - @Override - protected Account load() - { - return DAOImpl.getAccountById(id); - } -} diff --git a/crm/src/main/java/com/rex/crm/common/CRUDPanel.java b/crm/src/main/java/com/rex/crm/common/CRUDPanel.java index a0786b0..bc85edf 100644 --- a/crm/src/main/java/com/rex/crm/common/CRUDPanel.java +++ b/crm/src/main/java/com/rex/crm/common/CRUDPanel.java @@ -39,7 +39,8 @@ public enum Permissions { } - public CRUDPanel( final String id, final String entityName,final String entityId,EnumSet userPerms) { + public CRUDPanel(final String id, final String entityName, + final String entityId,EnumSet userPerms, final ICRUDActionListener listener) { super(id); Map entities = Configuration.getEntityTable(); final Entity entity = entities.get(entityName); @@ -57,11 +58,8 @@ public CRUDPanel( final String id, final String entityName,final String entity @Override public void onClick() { - if(entity.getName().equals("activity")){ - setResponsePage(new CreateEventPage(1)); - }else{ - setResponsePage(new CreateDataPage(entity.getName())); - } + + listener.create(); } }); add(addfrag); @@ -75,22 +73,9 @@ public void onClick() { @Override public void onClick() { - if(entityName.equals("account")){ - DAOImpl.deleteRecord(entityId, entityName); - setResponsePage(new AccountPage()); - }else if(entityName.equals("contact")){ - DAOImpl.deleteRecord(entityId, entityName); - setResponsePage(new ContactPage()); - }else if(entityName.equals("activity")) { - DAOImpl.deleteRecord(entityId, entityName); - setResponsePage(new ActivityPage()); - }else if(entityName.equalsIgnoreCase("crmuser")){ - if(DAOImpl.deleteRecord(entityId, entityName)>0){ - DAOImpl.updateCrmUserReport(entityId, "-1"); - } - setResponsePage(new UserPage()); - } - + + listener.delete(); + } }); add(delfrag); @@ -104,8 +89,8 @@ public void onClick() { @Override public void onClick() { - - setResponsePage(new EditDataPage(entity.getName(),entityId)); + listener.update(); + //setResponsePage(new EditDataPage(entity.getName(),entityId)); } }); addOrReplace(editfrag); diff --git a/crm/src/main/java/com/rex/crm/common/DefaultCRUDActionListener.java b/crm/src/main/java/com/rex/crm/common/DefaultCRUDActionListener.java new file mode 100644 index 0000000..33aacb1 --- /dev/null +++ b/crm/src/main/java/com/rex/crm/common/DefaultCRUDActionListener.java @@ -0,0 +1,21 @@ +package com.rex.crm.common; + +import java.io.Serializable; + +public class DefaultCRUDActionListener implements ICRUDActionListener, Serializable { + + @Override + public void create() { + } + + @Override + public void delete() { + + } + + @Override + public void update() { + + } + +} diff --git a/crm/src/main/java/com/rex/crm/common/EntityDetailPage.html b/crm/src/main/java/com/rex/crm/common/EntityDetailPage.html index cf686cd..0ac525c 100755 --- a/crm/src/main/java/com/rex/crm/common/EntityDetailPage.html +++ b/crm/src/main/java/com/rex/crm/common/EntityDetailPage.html @@ -4,10 +4,7 @@ - -
-
- -
- - - - - -
-
- 我的 -
-
-
- [operation bar] -
-
- -
- - - - - - - - - - - - - - - - - - - -
- - - -
-
-
-
- - \ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/common/UpdateDataFormPanel.java b/crm/src/main/java/com/rex/crm/common/UpdateDataFormPanel.java deleted file mode 100644 index c5cc353..0000000 --- a/crm/src/main/java/com/rex/crm/common/UpdateDataFormPanel.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.rex.crm.common; - -import java.util.ArrayList; -import java.util.EnumSet; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; -import org.apache.wicket.Component; -import org.apache.wicket.behavior.AbstractAjaxBehavior; -import org.apache.wicket.behavior.AttributeAppender; -import org.apache.wicket.markup.head.IHeaderResponse; -import org.apache.wicket.markup.head.OnDomReadyHeaderItem; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.list.AbstractItem; -import org.apache.wicket.markup.repeater.RepeatingView; -import org.apache.wicket.model.Model; - -import com.rex.crm.TemplatePage; -import com.rex.crm.db.DAOImpl; -import com.rex.crm.util.CRMUtility; -import com.rex.crm.util.Configuration; - -public class UpdateDataFormPanel extends TemplatePage { - private static final Logger logger = Logger.getLogger(UpdateDataFormPanel.class); - private static final long serialVersionUID = -2613412283023068638L; - - private static int NUM_OF_COLUMN = 3; - - public UpdateDataFormPanel(final String entityName, String id){ - this.setPageTitle("编辑"); - - Map entities = Configuration.getEntityTable(); - Entity entity = entities.get(entityName); - - - long lid = Long.parseLong(id); - Map map = DAOImpl.getEntityData(entity.getName(), entity.getFieldNames(), lid); - - add(new Label("name",String.valueOf(map.get("name")))); - add(new EntityDetailPanel("detailed",entity,map,id,3,entityName)); - - //set relations data - List relations = Configuration.getRelationsByName(entityName); - - RepeatingView relationRepeater = new RepeatingView("relationRepeater"); - add(relationRepeater); - - for(Relation r:relations){ - AbstractItem item = new AbstractItem(relationRepeater.newChildId()); - relationRepeater.add(item); - logger.debug(r.getSql()); - logger.debug("parms:"+id); - List list = DAOImpl.queryEntityRelationList(r.getSql(), id); - item.add(new RelationDataPanel("relationPanel",r,entityName,list,String.valueOf(lid))); - - } - - add(new AbstractAjaxBehavior(){ - - @Override - public void onRequest() { - } - - @Override - public void renderHead(Component component, IHeaderResponse response) { - super.renderHead(component, response); - response.render(OnDomReadyHeaderItem.forScript("$(\"#navitem-"+entityName+"\").addClass(\"active\");")); - } - - }); - add(new CRUDPanel("operationBar",entityName,null, EnumSet.of(CRUDPanel.Permissions.EDIT, CRUDPanel.Permissions.DEL))); - - - } - -} diff --git a/crm/src/main/java/com/rex/crm/reporter/ReportingTablePanel.java b/crm/src/main/java/com/rex/crm/reporter/ReportingTablePanel.java index 724d11e..0cbd290 100644 --- a/crm/src/main/java/com/rex/crm/reporter/ReportingTablePanel.java +++ b/crm/src/main/java/com/rex/crm/reporter/ReportingTablePanel.java @@ -1,33 +1,19 @@ package com.rex.crm.reporter; -import java.io.Serializable; -import java.util.EnumSet; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; -import org.apache.wicket.MarkupContainer; -import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.markup.html.list.AbstractItem; -import org.apache.wicket.markup.html.panel.Fragment; + import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.markup.repeater.RepeatingView; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.ajax.markup.html.AjaxLink; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.rex.crm.SearchCRMUserPage; -import com.rex.crm.account.AccountDetailPage; -import com.rex.crm.beans.Account; + import com.rex.crm.common.Entity; import com.rex.crm.common.Field; -import com.rex.crm.db.DAOImpl; -import com.rex.crm.util.CRMUtility; -import com.rex.crm.util.Configuration; + public class ReportingTablePanel extends Panel { private static final long serialVersionUID = 2501105233172820074L; diff --git a/crm/src/main/java/com/rex/crm/user/CRMUserDataProvider.java b/crm/src/main/java/com/rex/crm/user/CRMUserDataProvider.java index 0ecb4d7..a69e362 100644 --- a/crm/src/main/java/com/rex/crm/user/CRMUserDataProvider.java +++ b/crm/src/main/java/com/rex/crm/user/CRMUserDataProvider.java @@ -6,7 +6,6 @@ import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider; import org.apache.wicket.model.IModel; -import com.rex.crm.account.DetachableAccountModel; import com.rex.crm.beans.Account; import com.rex.crm.beans.CRMUser; import com.rex.crm.db.DAOImpl; From 94b324038e203b31a3d21d8159502f5969f97f26 Mon Sep 17 00:00:00 2001 From: Feiyun Date: Wed, 23 Oct 2013 00:16:05 +0800 Subject: [PATCH 044/520] =?UTF-8?q?=E5=9C=A8=E5=8C=BB=E9=99=A2=E4=B8=8B?= =?UTF-8?q?=E9=9D=A2=E6=B7=BB=E5=8A=A0=E5=8C=BB=E7=94=9F=EF=BC=8C=E5=8C=BB?= =?UTF-8?q?=E9=99=A2=E4=BF=A1=E6=81=AF=E6=97=A0=E6=B3=95=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=B8=A6=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/rex/crm/AccountPage.java | 2 +- .../main/java/com/rex/crm/ActivityPage.java | 2 +- .../main/java/com/rex/crm/ContactPage.java | 2 +- crm/src/main/java/com/rex/crm/UserPage.java | 2 +- .../com/rex/crm/common/AddEntityPage.java | 2 +- .../com/rex/crm/common/CreateDataPage.java | 22 ++++---- .../main/java/com/rex/crm/common/Entity.java | 13 +++++ .../com/rex/crm/common/EntityDetailPage.java | 11 +++- .../com/rex/crm/common/EntityDetailPanel.java | 2 +- .../main/java/com/rex/crm/common/Field.java | 32 +++++++++++ .../com/rex/crm/common/NewDataFormPanel.java | 54 ++++++++++++------- .../rex/crm/common/PageableTablePanel.java | 5 +- .../com/rex/crm/common/RelationDataPanel.java | 5 +- .../com/rex/crm/common/TableDataPanel.java | 2 +- crm/src/main/java/com/rex/crm/db/DAOImpl.java | 1 + .../java/com/rex/crm/util/Configuration.java | 12 +++++ crm/src/main/resources/entity.xml | 4 ++ 17 files changed, 131 insertions(+), 42 deletions(-) diff --git a/crm/src/main/java/com/rex/crm/AccountPage.java b/crm/src/main/java/com/rex/crm/AccountPage.java index 7298002..6fcb8ac 100644 --- a/crm/src/main/java/com/rex/crm/AccountPage.java +++ b/crm/src/main/java/com/rex/crm/AccountPage.java @@ -147,7 +147,7 @@ protected void onSubmit() { } } - add(new PageableTablePanel("datalist",entity,tdata)); + add(new PageableTablePanel("datalist",entity,tdata,null)); //for the side bar List>> types = null; diff --git a/crm/src/main/java/com/rex/crm/ActivityPage.java b/crm/src/main/java/com/rex/crm/ActivityPage.java index 29b4c51..ead1015 100644 --- a/crm/src/main/java/com/rex/crm/ActivityPage.java +++ b/crm/src/main/java/com/rex/crm/ActivityPage.java @@ -142,7 +142,7 @@ protected void onSubmit() { } - add(new PageableTablePanel("datalist",entity,tdata)); + add(new PageableTablePanel("datalist",entity,tdata,null)); //for the side bar diff --git a/crm/src/main/java/com/rex/crm/ContactPage.java b/crm/src/main/java/com/rex/crm/ContactPage.java index 888ad85..3031e94 100644 --- a/crm/src/main/java/com/rex/crm/ContactPage.java +++ b/crm/src/main/java/com/rex/crm/ContactPage.java @@ -147,7 +147,7 @@ protected void onSubmit() { } } - add(new PageableTablePanel("datalist",entity,tdata)); + add(new PageableTablePanel("datalist",entity,tdata,null)); //for the side bar diff --git a/crm/src/main/java/com/rex/crm/UserPage.java b/crm/src/main/java/com/rex/crm/UserPage.java index b9b5b52..bef6653 100644 --- a/crm/src/main/java/com/rex/crm/UserPage.java +++ b/crm/src/main/java/com/rex/crm/UserPage.java @@ -92,7 +92,7 @@ protected void onSubmit() { } - add(new PageableTablePanel("datalist",entity,tdata)); + add(new PageableTablePanel("datalist",entity,tdata,null)); //for the side bar List>> types = null; diff --git a/crm/src/main/java/com/rex/crm/common/AddEntityPage.java b/crm/src/main/java/com/rex/crm/common/AddEntityPage.java index ab66a83..22a090b 100644 --- a/crm/src/main/java/com/rex/crm/common/AddEntityPage.java +++ b/crm/src/main/java/com/rex/crm/common/AddEntityPage.java @@ -52,7 +52,7 @@ public AddEntityPage(final String entityName, String id){ logger.debug(r.getSql()); logger.debug("parms:"+id); List list = DAOImpl.queryEntityRelationList(r.getSql(), id); - item.add(new RelationDataPanel("relationPanel",r,entityName,list,String.valueOf(lid))); + item.add(new RelationDataPanel("relationPanel",r,entityName,list,String.valueOf(lid),null)); } diff --git a/crm/src/main/java/com/rex/crm/common/CreateDataPage.java b/crm/src/main/java/com/rex/crm/common/CreateDataPage.java index 28c0594..00d0adf 100644 --- a/crm/src/main/java/com/rex/crm/common/CreateDataPage.java +++ b/crm/src/main/java/com/rex/crm/common/CreateDataPage.java @@ -36,23 +36,23 @@ public CreateDataPage(){ StringValue entityName = getRequest().getRequestParameters().getParameterValue("entityName"); String name = entityName.toString(); - Set names = getRequest().getRequestParameters().getParameterNames(); - Map map = Maps.newHashMap(); - for(String nm:names){ - StringValue sv = getRequest().getRequestParameters().getParameterValue(nm); - map.put(nm, sv.toString()); - } +// Set names = getRequest().getRequestParameters().getParameterNames(); +// Map map = Maps.newHashMap(); +// for(String nm:names){ +// StringValue sv = getRequest().getRequestParameters().getParameterValue(nm); +// map.put(nm, sv.toString()); +// } - initPage(name,map); + initPage(name,null); } - public CreateDataPage(String entityName){ + public CreateDataPage(String entityName,final Map params){ - initPage(entityName,null); + initPage(entityName,params); } - private void initPage(String entityName,Map map){ + private void initPage(String entityName,Map params){ //this.getRequest(). this.setPageTitle("创建"); //this.getPageParameters().get @@ -60,7 +60,7 @@ private void initPage(String entityName,Map map){ //if (entityName == null) entityName="contact"; final Entity entity = entities.get(entityName); - add(new NewDataFormPanel("formPanel",entity,map)); + add(new NewDataFormPanel("formPanel",entity,params)); add(new AbstractAjaxBehavior(){ diff --git a/crm/src/main/java/com/rex/crm/common/Entity.java b/crm/src/main/java/com/rex/crm/common/Entity.java index f4e6d7a..e9b0f56 100644 --- a/crm/src/main/java/com/rex/crm/common/Entity.java +++ b/crm/src/main/java/com/rex/crm/common/Entity.java @@ -90,6 +90,19 @@ public List getSearchableFields(){ } return res; } + + public List getParamFields(){ + List res = Lists.newArrayList(); + if(fields !=null){ + for(Field f:fields){ + if(f.isParam()){ + res.add(f); + } + } + } + return res; + } + public List getDisplayNames(){ List fd = Lists.newArrayList(); if(fields !=null){ diff --git a/crm/src/main/java/com/rex/crm/common/EntityDetailPage.java b/crm/src/main/java/com/rex/crm/common/EntityDetailPage.java index 8e97516..1538f9c 100644 --- a/crm/src/main/java/com/rex/crm/common/EntityDetailPage.java +++ b/crm/src/main/java/com/rex/crm/common/EntityDetailPage.java @@ -15,6 +15,8 @@ import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.list.AbstractItem; import org.apache.wicket.markup.repeater.RepeatingView; + +import com.google.common.collect.Maps; import com.rex.crm.AccountPage; import com.rex.crm.ActivityPage; import com.rex.crm.ContactPage; @@ -56,13 +58,20 @@ public EntityDetailPage(final String entityName, final String id){ RepeatingView relationRepeater = new RepeatingView("relationRepeater"); add(relationRepeater); + List paramFields = entity.getParamFields(); + Map params = Maps.newHashMap(); + for(Field f:paramFields){ + params.put(entityName+"."+f.getName(), map.get(f.getName())); + } + + for(Relation r:relations){ AbstractItem item = new AbstractItem(relationRepeater.newChildId()); relationRepeater.add(item); logger.debug(r.getSql()); logger.debug("parms:"+id); List list = DAOImpl.queryEntityRelationList(r.getSql(), id); - item.add(new RelationDataPanel("relationPanel",r,entityName,list,String.valueOf(lid))); + item.add(new RelationDataPanel("relationPanel",r,entityName,list,String.valueOf(lid),params)); } if(entityName.equalsIgnoreCase("contact") || entityName.equalsIgnoreCase("account")){ diff --git a/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.java b/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.java index 02ab8d4..890dd6e 100644 --- a/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.java +++ b/crm/src/main/java/com/rex/crm/common/EntityDetailPanel.java @@ -180,7 +180,7 @@ private class DetailLinkFragment extends Fragment { public DetailLinkFragment(String id, String markupId, MarkupContainer markupProvider, String caption) { super(id, markupId, markupProvider); final String str = DAOImpl.queryEntityByName(caption); - logger.debug("ididididididididididdidi" + str); + add(new Link("detailclick") { @Override public void onClick() { diff --git a/crm/src/main/java/com/rex/crm/common/Field.java b/crm/src/main/java/com/rex/crm/common/Field.java index b0e2d38..b5a499c 100644 --- a/crm/src/main/java/com/rex/crm/common/Field.java +++ b/crm/src/main/java/com/rex/crm/common/Field.java @@ -26,6 +26,9 @@ public class Field implements Serializable { private String picklist = null; @Expose private boolean isEditable; + @Expose + private boolean isParam; + @Expose private boolean isSearchable; @Expose @@ -41,6 +44,11 @@ public class Field implements Serializable { private String alias = null; @Expose private boolean isBaseInfo = false; + @Expose + private String default_value = null; + @Expose + private String default_value_type = null; + public boolean isRequired() { return isRequired; } @@ -183,6 +191,30 @@ public boolean isSearchable() { public void setSearchable(boolean isSearchable) { this.isSearchable = isSearchable; } + + public String getDefault_value() { + return default_value; + } + + public void setDefault_value(String default_value) { + this.default_value = default_value; + } + + public String getDefault_value_type() { + return default_value_type; + } + + public void setDefault_value_type(String default_value_type) { + this.default_value_type = default_value_type; + } + + public boolean isParam() { + return isParam; + } + + public void setParam(boolean isParam) { + this.isParam = isParam; + } } diff --git a/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.java b/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.java index 8c5baf6..d4b7e67 100644 --- a/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.java +++ b/crm/src/main/java/com/rex/crm/common/NewDataFormPanel.java @@ -6,6 +6,7 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; @@ -36,6 +37,7 @@ import org.apache.wicket.model.Model; import org.apache.wicket.request.mapper.parameter.PageParameters; +import com.google.common.base.Splitter; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.rex.crm.PageFactory; @@ -58,7 +60,7 @@ public class NewDataFormPanel extends Panel { private static int NUM_OF_COLUMN = 1; final String user = ((SignIn2Session) getSession()).getUser(); - public NewDataFormPanel(String id, final Entity entity, final Map relationIds) { + public NewDataFormPanel(String id, final Entity entity,final Map params) { super(id); final Map models = Maps.newHashMap(); // final Map fieldNameToModel = Maps.newHashMap(); @@ -140,17 +142,29 @@ public NewDataFormPanel(String id, final Entity entity, final Map pickList = DAOImpl.queryRelationDataList(currentField.getRelationTable(), userId); - Map list = Maps.newHashMap(); - List ids = Lists.newArrayList(); - for (Choice p : pickList) { - list.put(p.getId(), p.getVal()); - ids.add(p.getId()); - } +// List pickLista = DAOImpl.queryRelationDataList(currentField.getRelationTable(), userId); +// Map list = Maps.newHashMap(); +// List idsa = Lists.newArrayList(); +// for (Choice p : pickList) { +// list.put(p.getId(), p.getVal()); +// ids.add(p.getId()); +// } long foreignKey = -1L; - if (relationIds != null && relationIds.containsKey(currentField.getAlias())) { - foreignKey = Long.parseLong(relationIds.get(currentField.getAlias())); + String defaultValue = ""; + if (currentField.getDefault_value_type()!=null && currentField.getDefault_value_type().equalsIgnoreCase("var")){ + if (params != null) { + Iterable splits = Splitter.on(",").split(currentField.getDefault_value()); + Iterator it = splits.iterator(); + String choiceId = it.next(); + String choiceValue = it.next(); + if(choiceId!=null && choiceId!=null && params.get(choiceId.trim())!=null && params.get(choiceValue.trim())!=null){ + foreignKey = Long.parseLong(String.valueOf(params.get(choiceId.trim()))); + defaultValue = String.valueOf(params.get(choiceValue.trim())); + } + + } } + IModel choiceModel = new Model(foreignKey); String fn = ""; if (currentField.getAlias() != null) { @@ -161,7 +175,7 @@ public NewDataFormPanel(String id, final Entity entity, final Map textModel = new Model(""); models.put(currentField.getName(), textModel); - columnitem.add(new Textarea("celldatafield", "textAreaFragment", this, textModel)); + columnitem.add(new TextareaFrag("celldatafield", "textAreaFragment", this, textModel)); } else { IModel textModel = new Model(""); models.put(currentField.getName(), textModel); @@ -290,9 +304,9 @@ public String getIdValue(Long id, int index) { } } - private class Textarea extends Fragment { + private class TextareaFrag extends Fragment { - public Textarea(String id, String markupId, MarkupContainer markupProvider, IModel model) { + public TextareaFrag(String id, String markupId, MarkupContainer markupProvider, IModel model) { super(id, markupId, markupProvider); // TODO Auto-generated constructor stub add(new TextArea("address", model)); @@ -302,19 +316,19 @@ public Textarea(String id, String markupId, MarkupContainer markupProvider, IMod private class RelationTableSearchFragment extends Fragment { public RelationTableSearchFragment(String id, String markupId, - MarkupContainer markupProvider, final String entityName, final String value, IModel model) { + MarkupContainer markupProvider, final String entityName, final String defaultValue, final long defaultId) { super(id, markupId, markupProvider); PageParameters params = new PageParameters(); params.set("en", entityName); - params.set("target", (long) model.getObject()); + params.set("target", defaultId); PopupSettings popupSettings = new PopupSettings("查找").setHeight(470) .setWidth(850).setLeft(150).setTop(200); add(new BookmarkablePageLink("search_btn", SelectEntryPage.class, params).setPopupSettings(popupSettings)); - HiddenField hidden = new HiddenField("selected_id_hidden", model); + HiddenField hidden = new HiddenField("selected_id_hidden", new Model(defaultId)); hidden.add(new AttributeAppender("id", entityName + "_id")); add(hidden); - TextField text = new TextField("selected_value_input", new Model(value)); + TextField text = new TextField("selected_value_input", new Model(defaultValue)); text.add(new AttributeAppender("id", entityName + "_name")); add(text); } @@ -358,8 +372,10 @@ public TextInputFragment(String id, String markupId, text.add(new AttributeAppender("id", new Model(currentField.getName()), ";")); } } + + + //发送有邮件方法 - public void sendMail(String getUserByLoginName, String sendEmail) { Session sendMailSession = null; SMTPTransport transport = null; diff --git a/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java b/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java index 53c25d8..7674673 100644 --- a/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java +++ b/crm/src/main/java/com/rex/crm/common/PageableTablePanel.java @@ -36,7 +36,8 @@ public class PageableTablePanel extends Panel { private static final long serialVersionUID = 2501105233172820074L; private static final Logger logger = Logger.getLogger(PageableTablePanel.class); - public PageableTablePanel(String id, final Entity entity, List mapList) { + + public PageableTablePanel(String id, final Entity entity, List mapList,final Map params) { super(id); add(new Label("table_title",entity.getDisplay())); @@ -145,7 +146,7 @@ public void create() { if(entity.getName().equals("activity")){ setResponsePage(new CreateEventPage(1)); }else{ - setResponsePage(new CreateDataPage(entity.getName())); + setResponsePage(new CreateDataPage(entity.getName(),params)); } } }; diff --git a/crm/src/main/java/com/rex/crm/common/RelationDataPanel.java b/crm/src/main/java/com/rex/crm/common/RelationDataPanel.java index 9d73ba0..06b2776 100644 --- a/crm/src/main/java/com/rex/crm/common/RelationDataPanel.java +++ b/crm/src/main/java/com/rex/crm/common/RelationDataPanel.java @@ -18,6 +18,7 @@ import org.apache.wicket.model.Model; import org.apache.wicket.request.mapper.parameter.PageParameters; +import com.google.common.collect.Maps; import com.rex.crm.SearchCRMUserPage; import com.rex.crm.SearchContactPage; import com.rex.crm.SignIn2Session; @@ -29,7 +30,7 @@ public class RelationDataPanel extends Panel { - public RelationDataPanel( String id, Relation relation, String entityName,List list,final String entityId) { + public RelationDataPanel( String id, Relation relation, String entityName,List list,final String entityId,final Map params) { super(id); @@ -39,7 +40,7 @@ public RelationDataPanel( String id, Relation relation, String entityName,List l final String collapseId = divC.getMarkupId(); Entity entity = Configuration.getEntityByName(relation.getTo()); - divC.add(new PageableTablePanel("tableData",entity,list)); + divC.add(new PageableTablePanel("tableData",entity,list,params)); RepeatingView btn_repeater = new RepeatingView("btn_repeater"); diff --git a/crm/src/main/java/com/rex/crm/common/TableDataPanel.java b/crm/src/main/java/com/rex/crm/common/TableDataPanel.java index 8ef95b1..9f9e720 100644 --- a/crm/src/main/java/com/rex/crm/common/TableDataPanel.java +++ b/crm/src/main/java/com/rex/crm/common/TableDataPanel.java @@ -99,7 +99,7 @@ public void create() { if(entity.getName().equals("activity")){ setResponsePage(new CreateEventPage(1)); }else{ - setResponsePage(new CreateDataPage(entity.getName())); + setResponsePage(new CreateDataPage(entity.getName(),null)); } } }; diff --git a/crm/src/main/java/com/rex/crm/db/DAOImpl.java b/crm/src/main/java/com/rex/crm/db/DAOImpl.java index ee83256..cd9d3a6 100644 --- a/crm/src/main/java/com/rex/crm/db/DAOImpl.java +++ b/crm/src/main/java/com/rex/crm/db/DAOImpl.java @@ -799,6 +799,7 @@ public static String queryRelationDataById(final String tableName, final String return result; } + public static String queryPickListByIdCached(final String picklist, final String id){ String value = ""; try{ diff --git a/crm/src/main/java/com/rex/crm/util/Configuration.java b/crm/src/main/java/com/rex/crm/util/Configuration.java index 9713c8e..8b4662e 100644 --- a/crm/src/main/java/com/rex/crm/util/Configuration.java +++ b/crm/src/main/java/com/rex/crm/util/Configuration.java @@ -228,6 +228,16 @@ public static List getEntities() { field.setFieldGroup(fieldGroup); } + String default_value = sub2.getString("default-value"); + if(default_value !=null){ + field.setDefault_value(default_value); + } + + String default_value_type = sub2.getString("default-value-type"); + if(default_value_type !=null){ + field.setDefault_value_type(default_value_type); + } + field.setPrimaryKey(Boolean.parseBoolean(sub2.getString("isPrimaryKey"))); field.setDetailLink(Boolean.parseBoolean(sub2.getString("isDetailLink"))); field.setVisible(Boolean.parseBoolean(sub2.getString("isVisible"))); @@ -235,6 +245,8 @@ public static List getEntities() { field.setRequired(Boolean.parseBoolean(sub2.getString("isRequired"))); field.setBaseInfo(Boolean.parseBoolean(sub2.getString("isBaseInfo"))); field.setSearchable(Boolean.parseBoolean(sub2.getString("isSearchable"))); + field.setParam(Boolean.parseBoolean(sub2.getString("isParam"))); + } } diff --git a/crm/src/main/resources/entity.xml b/crm/src/main/resources/entity.xml index 8fcdc59..5e32ab8 100644 --- a/crm/src/main/resources/entity.xml +++ b/crm/src/main/resources/entity.xml @@ -60,6 +60,7 @@ false false false + true 0 关键信息 @@ -73,6 +74,7 @@ true true 1 + true 关键信息 @@ -638,6 +640,8 @@ true 1 account + var + account.id\,account.name 关键信息 From 00365f29a48d11cd56abeb8aca052a9468bd8f43 Mon Sep 17 00:00:00 2001 From: DongJingChao <447958999@qq.com> Date: Wed, 23 Oct 2013 09:59:07 +0800 Subject: [PATCH 045/520] modify createevenpage code --- .../java/com/rex/crm/CreateEventPage.java | 211 +----------------- 1 file changed, 10 insertions(+), 201 deletions(-) diff --git a/crm/src/main/java/com/rex/crm/CreateEventPage.java b/crm/src/main/java/com/rex/crm/CreateEventPage.java index bcd82b5..998f3c9 100644 --- a/crm/src/main/java/com/rex/crm/CreateEventPage.java +++ b/crm/src/main/java/com/rex/crm/CreateEventPage.java @@ -74,209 +74,14 @@ public class CreateEventPage extends TemplatePage */ public CreateEventPage() { - Map entities = Configuration.getEntityTable(); - Entity entity = entities.get("activity"); - setPageTitle(entity.getDisplay()); - final String uid = ((SignIn2Session)getSession()).getUserId(); - final String user = ((SignIn2Session)getSession()).getUser(); - final int roleId = ((SignIn2Session)getSession()).getRoleId(); - CRMUser crmUser = DAOImpl.getCRMUserInfoById(Integer.parseInt(uid)); - //辅导名称拼接字段 - final StringBuffer concahName = new StringBuffer(); - concahName.append(crmUser.getName()); - Form form = new Form("form"){ - @Override - protected void onSubmit() - { - logger.debug("this form was submitted!"); - String sd = getRequest().getPostParameters().getParameterValue("start_date").toString(); - String st = getRequest().getPostParameters().getParameterValue("start_time").toString(); - String ed = getRequest().getPostParameters().getParameterValue("end_date").toString(); - String et = getRequest().getPostParameters().getParameterValue("end_time").toString(); - String visit_type = String.valueOf(activity_type); - SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - String sdt = sd+ " " +st; - String edt = ed + " " + et; - int contactId = 0; - Date startdt = null; - Date enddt = null; - try { - startdt = dateformat.parse(sdt); - enddt = dateformat.parse(edt); - } catch (ParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - if(null==hidden_contact_select){ - contactId = 0; - }else{ - contactId = Integer.parseInt(hidden_contact_select); - } - try { - - int crmuserId = 0; - String participants = user; - if(event_type == 1){ - //visiting - crmuserId = Integer.parseInt(uid); - - }else if(event_type == 2){ - //coaching - crmuserId = Integer.parseInt(uid);; - participants = participants+ ", "+ selected_user; - concahName.append(sd); - hidden_contact_select = "0"; - contactId = -1; - concahName.append("拜访辅导"); - act_title_input = concahName.toString(); - } - //insert the event, and return the generated id of the event - long generatedkey = DAOImpl.addCalendarEventForCoach(crmuserId, contactId,String.valueOf(activity_type.getId()), - act_title_input, String.valueOf(startdt.getTime()/1000), - String.valueOf(enddt.getTime()/1000),1,user,user,user, - String.valueOf(visiting_purpose.getId()), - String.valueOf(feature_product.getId()),event_type.intValue(),participants, - coach,location,total_score,planing,openling,enquery_listening,deliverable,objection_handing,summary); - logger.debug("generatedkey:"+ generatedkey); - if(generatedkey>0){ - if(event_type == 1){ - //if it is a visiting, we only send this event to the owner; - DAOImpl.insert2UserRelationTable("activity",uid,String.valueOf(generatedkey)); - }else if(event_type == 2){ - //if it is a coaching, we need send this event to the manager and sales - //add new record for the manager - logger.debug("key:"+String.valueOf(generatedkey)); - DAOImpl.insert2UserRelationTable("activity",uid,String.valueOf(generatedkey)); - //add new record for the sales - DAOImpl.insert2UserRelationTable("activity",hidden_select_user,String.valueOf(generatedkey)); - } - } - } catch (NumberFormatException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - setResponsePage(PageFactory.createPage("calendar")); - } - }; - add(form); - //辅导者 - TextField coach = new TextField("coach", new PropertyModel(this,"coach")); - coach.add(new AttributeAppender("value",crmUser.getName())); - form.add(coach); - //创建人 - TextField owner = new TextField("owner", new PropertyModel(this,"owner")); - owner.add(new AttributeAppender("value",crmUser.getName())); - form.add(owner); - //创建时间 - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 - TextField whenadded = new TextField("whenadded", new PropertyModel(this,"whenadded")); - whenadded.add(new AttributeAppender("value",df.format(new Date()))); - form.add(whenadded); - //状态默认为计划中 - TextField status = new TextField("status", new PropertyModel(this,"status")); - form.add(status); - //计划地点 - TextField location = new TextField("location", new PropertyModel(this,"location")); - form.add(location); - //分数 - TextField total_score = new TextField("total_score", new PropertyModel(this,"total_score")); - form.add(total_score); - TextField planing = new TextField("planing", new PropertyModel(this,"planing")); - form.add(planing); - TextField openling = new TextField("openling", new PropertyModel(this,"openling")); - form.add(openling); - TextField enquery_listening = new TextField("enquery_listening", new PropertyModel(this,"enquery_listening")); - form.add(enquery_listening); - TextField deliverable = new TextField("deliverable", new PropertyModel(this,"deliverable")); - form.add(deliverable); - TextField objection_handing = new TextField("objection_handing", new PropertyModel(this,"objection_handing")); - form.add(objection_handing); - TextField summary = new TextField("summary", new PropertyModel(this,"summary")); - form.add(summary); - StringValue startdateValue = this.getRequest().getRequestParameters().getParameterValue("startdate"); - - String startdate = null; - long current = System.currentTimeMillis(); - Date current_date_time = new Date(current); - SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); - //set default time to current time - if(startdateValue != null && !startdateValue.isEmpty() && !startdateValue.isNull()){ - startdate = startdateValue.toString(); - }else{ - startdate = dateformat.format(current_date_time); - } - WebMarkupContainer start_date_input = new WebMarkupContainer("start_date_input"); - form.add(start_date_input); - start_date_input.add(new AttributeModifier("value",startdate)); - SimpleDateFormat timeformatter = new SimpleDateFormat("HH:mm"); - WebMarkupContainer start_time_input = new WebMarkupContainer("start_time_input"); - form.add(start_time_input); - start_time_input.add(new AttributeModifier("value",timeformatter.format(current_date_time))); - SimpleDateFormat dateformat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - Date sDate = current_date_time; - try { - sDate = dateformat2.parse(startdate+ " " + timeformatter.format(current_date_time)); - } catch (ParseException e) { - logger.warn("failed to parse date:",e); - } - Date next_date_time = new Date(sDate.getTime()+3600*1000); - WebMarkupContainer end_date_input = new WebMarkupContainer("end_date_input"); - form.add(end_date_input); - end_date_input.add(new AttributeModifier("value",dateformat.format(next_date_time))); - WebMarkupContainer end_time_input = new WebMarkupContainer("end_time_input",new Model("")); - form.add(end_time_input); - end_time_input.add(new AttributeModifier("value",timeformatter.format(next_date_time))); - PopupSettings popupSettings = new PopupSettings("查找").setHeight(470).setWidth(850).setLeft(150).setTop(200); - form.add(new BookmarkablePageLink("search_btn", SearchContactPage.class).setPopupSettings(popupSettings)); - form.add(new HiddenField("hidden_contact_select" ,new PropertyModel(this,"hidden_contact_select"))); - form.add(new TextField("contact_select", new Model(""))); - PageParameters params = new PageParameters(); - params.set("mid", uid); - logger.debug("uid:"+uid); - form.add(new BookmarkablePageLink("search_user_btn", SelectCRMUserPage.class,params).setPopupSettings(popupSettings)); - form.add(new HiddenField("hidden_select_user" ,new PropertyModel(this,"hidden_select_user"))); - form.add(new TextField("selected_user" ,new PropertyModel(this,"selected_user"))); - IModel visiting_purpose_choices_model = new AbstractReadOnlyModel() - { - @Override - public List getObject() { - List choices = new ArrayList(); - return DAOImpl.queryPickListByFilter("activity_visiting_purpose_pl", "activity_type", String.valueOf(activity_type.getId())); - } - }; - //visiting purpose choice - final DropDownChoice visiting_purpose_choice = createDropDownListFromPickList("visiting_purpose_input","com_visiting_purpose_pl",visiting_purpose_choices_model,new PropertyModel(this,"visiting_purpose")); - visiting_purpose_choice.setOutputMarkupId(true); - form.add(visiting_purpose_choice); - //event type choice - DropDownChoice activity_type_choice = createDropDownListFromPickList("activity_type_input","activity_activity_types_pl",null,new PropertyModel(this,"activity_type")); - activity_type_choice.setOutputMarkupId(true); - form.add(activity_type_choice); - activity_type_choice.add(new AjaxFormComponentUpdatingBehavior("onchange") - { - private static final long serialVersionUID = 1L; - @Override - protected void onUpdate(AjaxRequestTarget target) { - target.add(visiting_purpose_choice); - } - }); - //set event type - RadioGroup event_type_group=new RadioGroup("event_type_group",new PropertyModel(this,"event_type")); - event_type_group.add(new Radio("radio1", new Model(1L))); - Radio coachingRadio = new Radio("radio2", new Model(2L)); - if(roleId == 3){ - coachingRadio.add(new AttributeAppender("disabled","true")); - } - event_type_group.add(coachingRadio); - form.add(event_type_group); - form.add(createDropDownListFromPickList("feature_product_input","activity_feature_product_pl",null,new PropertyModel(this,"feature_product"))); - form.add(new TextField("act_title_input", new PropertyModel(this,"act_title_input"))); - //拜访辅导。辅导者,状态, + initPage(0); } - public CreateEventPage(final int type) + public CreateEventPage( int type) { + initPage(type); + } + public void initPage(final int type){ Map entities = Configuration.getEntityTable(); Entity entity = entities.get("activity"); setPageTitle(entity.getDisplay()); @@ -358,7 +163,11 @@ protected void onSubmit() } catch (Exception e) { e.printStackTrace(); } - setResponsePage(new ActivityPage()); + if(type == 0){ + setResponsePage(PageFactory.createPage("calendar")); + }else{ + setResponsePage(new ActivityPage()); + } } }; add(form); From 5a5d054758a2b14cba5a5b49ca03725d444f1cd9 Mon Sep 17 00:00:00 2001 From: DongJingChao <447958999@qq.com> Date: Wed, 23 Oct 2013 11:57:31 +0800 Subject: [PATCH 046/520] modify EventViewerPage reduce duplicate code --- .../java/com/rex/crm/EventViewerPage.html | 74 +++--- .../java/com/rex/crm/EventViewerPage.java | 237 ++++++------------ 2 files changed, 109 insertions(+), 202 deletions(-) diff --git a/crm/src/main/java/com/rex/crm/EventViewerPage.html b/crm/src/main/java/com/rex/crm/EventViewerPage.html index 328f7d7..f1a32a8 100755 --- a/crm/src/main/java/com/rex/crm/EventViewerPage.html +++ b/crm/src/main/java/com/rex/crm/EventViewerPage.html @@ -14,7 +14,7 @@
-
+
@@ -39,44 +39,44 @@
-
- + + + + + -
+
diff --git a/crm/src/main/java/com/rex/crm/EventViewerPage.java b/crm/src/main/java/com/rex/crm/EventViewerPage.java index 0a748d4..7b7951d 100644 --- a/crm/src/main/java/com/rex/crm/EventViewerPage.java +++ b/crm/src/main/java/com/rex/crm/EventViewerPage.java @@ -50,26 +50,33 @@ public class EventViewerPage extends TemplatePage protected String endTime; protected String startTime; protected String hidden_contact_select; - /** - * Constructor - */ - public EventViewerPage() - { - - Map entities = Configuration.getEntityTable(); - Entity entity = entities.get("activity"); - setPageTitle(entity.getDisplay()); - final String uid = ((SignIn2Session)getSession()).getUserId(); - final int roleId = ((SignIn2Session)getSession()).getRoleId(); + /** + * Constructor + */ + public EventViewerPage() + { StringValue eventIdValue = this.getRequest().getRequestParameters().getParameterValue("eventid"); - //final long eventId long eid = 0; if(!eventIdValue.isEmpty() && !eventIdValue.isNull()){ - eid = eventIdValue.toLong(); - + eid = eventIdValue.toLong(); } - final long eventId = eid; - Map map = DAOImpl.queryEntityById(entity.getSql_ent(), String.valueOf(eventId)); + final long eventId = eid; + initPage(eid,0); + } + + public EventViewerPage(String id) { + + final int eventId = Integer.parseInt(id); + initPage(eventId,1); + } + +public void initPage(final long eid,final int type ){ + Map entities = Configuration.getEntityTable(); + Entity entity = entities.get("activity"); + setPageTitle(entity.getDisplay()); + final String uid = ((SignIn2Session)getSession()).getUserId(); + final int roleId = ((SignIn2Session)getSession()).getRoleId(); + Map map = DAOImpl.queryEntityById(entity.getSql_ent(), String.valueOf(eid)); //if the complete and edit button visible; boolean write_btn_visible = true; //get the event status @@ -100,40 +107,25 @@ public EventViewerPage() protected void onSubmit() { //update status of calenderEvent mark it to be completed - Date act_end_datetime = new Date(); - DAOImpl.updateStatusOfCalendarEvent((int)eventId, 2,act_end_datetime); - setResponsePage(PageFactory.createPage("calendar")); + Date act_end_datetime = new Date(); + DAOImpl.updateStatusOfCalendarEvent((int)eid, 2,act_end_datetime); + //判断类型如果是辅导类型则跳转到评分界面 + if(type == 0){ + setResponsePage(PageFactory.createPage("calendar")); + }else{ + setResponsePage(new ActivityPage()); + } } }; add(form); - int eventType = 0; - if(map != null){ - eventType = ((Number) map.get("event_type")).intValue(); - logger.debug("eventType:"+eventType); - } - final int event_type = eventType; - /* if(event_type==2){ - Link cancel_event_btn = new Link("cancel_event_btn") { - @Override - public void onClick() { - DAOImpl.updateStatusOfActivity((int)eventId,3); - setResponsePage(PageFactory.createPage("calendar")); - } - }; - cancel_event_btn.setVisible(write_btn_visible); - form.addOrReplace(cancel_event_btn); - }*/ + Link edit_event_btn = new Link("edit_event_btn") { + @Override public void onClick() { - //判断活动类型 - if(event_type==1){ - setResponsePage(new EventEditorPage(eventId)); - }else{ - setResponsePage(new EventCoachEditorPage(eventId)); - } - + + setResponsePage(new EventEditorPage(eid)); } }; edit_event_btn.setVisible(write_btn_visible); @@ -143,8 +135,13 @@ public void onClick() { @Override public void onClick() { - DAOImpl.deleteRecord( String.valueOf(eventId), "activity"); - setResponsePage(PageFactory.createPage("calendar")); + + DAOImpl.deleteRecord( String.valueOf(eid), "activity"); + if(type == 0){ + setResponsePage(PageFactory.createPage("calendar")); + }else{ + setResponsePage(new ActivityPage()); + } } }; delete_event_btn.setVisible(write_btn_visible); @@ -155,132 +152,42 @@ public void onClick() { form.add(complete_btn); // List events = DAOImpl.getEventsByUserId(Integer.parseInt(uid)); - logger.debug("eventID is:"+ eventId); + logger.debug("eventID is:"+ eid); //add(new Label("name",String.valueOf(map.get("name")))); - add(new EntityDetailPanel("detailed",entity,map,String.valueOf(eventId),1,"calendar")); - } - - public EventViewerPage(String id) - { - - Map entities = Configuration.getEntityTable(); - final Entity entity = entities.get("activity"); - setPageTitle(entity.getDisplay()); - final String uid = ((SignIn2Session)getSession()).getUserId(); - final int roleId = ((SignIn2Session)getSession()).getRoleId(); - final int eventId = Integer.parseInt(id); - logger.debug("entity"+entity); - Map map = DAOImpl.queryEntityById(entity.getSql_ent(), String.valueOf(eventId)); - logger.debug("entity.getSql_ent()"+entity.getSql_ent()); - //if the complete and edit button visible; - boolean write_btn_visible = true; - //get the event status - int status = 2; - - if(map != null){ - Object st = map.get("act_status"); - status = ((Number)st).intValue(); - } - - if(status == 1){ - write_btn_visible =true; - }else{ - write_btn_visible =false; - } - - if (map != null) { - int eventType = ((Number) map.get("event_type")).intValue(); - if (eventType == 2 && roleId == 3) { - // for the sales rep, no permission to edit the coaching event - write_btn_visible = false; - } - }// logger.debug("roleId" + roleId); - - Form form = new Form("form"){ - @Override - protected void onSubmit() - { - //update status of calenderEvent mark it to be completed - Date act_end_datetime = new Date(); - DAOImpl.updateStatusOfCalendarEvent((int)eventId,2,act_end_datetime); - if(entity.getName().equals("activity")){ - setResponsePage(new ActivityPage()); - }else{ - setResponsePage(PageFactory.createPage("calendar")); - } - } - }; - add(form); - - Link edit_event_btn = new Link("edit_event_btn") { - - @Override - public void onClick() { - - setResponsePage(new EventEditorPage(eventId)); - } - }; - edit_event_btn.setVisible(write_btn_visible); - form.addOrReplace(edit_event_btn); - - Link delete_event_btn = new Link("delete_event_btn") { - - @Override - public void onClick() { - - DAOImpl.deleteRecord( String.valueOf(eventId), "activity"); - if(entity.getName().equals("activity")){ - setResponsePage(new ActivityPage()); - }else{ - setResponsePage(PageFactory.createPage("calendar")); - } - } - }; - delete_event_btn.setVisible(write_btn_visible); - form.addOrReplace(delete_event_btn); - - WebMarkupContainer complete_btn = new WebMarkupContainer("complete_btn"); - complete_btn.setVisible(write_btn_visible); - form.add(complete_btn); - - // List events = DAOImpl.getEventsByUserId(Integer.parseInt(uid)); - logger.debug("eventID is:"+ eventId); - - //add(new Label("name",String.valueOf(map.get("name")))); - add(new EntityDetailPanel("detailed",entity,map,String.valueOf(eventId),1,"calendar")); - - - } - - class SelectOption implements Serializable{ - private int key; - private String value; - - public SelectOption(int key, String value) { - this.key = key; - this.value = value; - } - public SelectOption() { - - } + add(new EntityDetailPanel("detailed",entity,map,String.valueOf(eid),1,"calendar")); + +} + + + class SelectOption implements Serializable{ + private int key; + private String value; + + public SelectOption(int key, String value) { + this.key = key; + this.value = value; + } + public SelectOption() { + + } - public int getKey() { - return key; - } + public int getKey() { + return key; + } - public void setKey(int key) { - this.key = key; - } + public void setKey(int key) { + this.key = key; + } - public String getValue() { - return value; - } + public String getValue() { + return value; + } - public void setValue(String value) { - this.value = value; - } - } + public void setValue(String value) { + this.value = value; + } + } } From 4f180ec57ede75bd3defd0814e7a135043a25acc Mon Sep 17 00:00:00 2001 From: MikeLee Date: Wed, 23 Oct 2013 14:04:49 +0800 Subject: [PATCH 047/520] Table style altered --- .../main/java/com/rex/crm/AccountPage.html | 64 ++++----- .../main/java/com/rex/crm/ActivityPage.html | 62 +++++---- .../main/java/com/rex/crm/ContactPage.html | 62 +++++---- crm/src/main/java/com/rex/crm/UserPage.html | 62 +++++---- .../java/com/rex/crm/common/TeamManPanel.html | 131 +++++++++--------- .../java/com/rex/crm/common/TeamManPanel.java | 9 +- crm/src/main/webapp/css/extra.css | 30 ++-- 7 files changed, 224 insertions(+), 196 deletions(-) diff --git a/crm/src/main/java/com/rex/crm/AccountPage.html b/crm/src/main/java/com/rex/crm/AccountPage.html index 4ee8ac0..e76a204 100755 --- a/crm/src/main/java/com/rex/crm/AccountPage.html +++ b/crm/src/main/java/com/rex/crm/AccountPage.html @@ -1,37 +1,37 @@ - - - -
-
- -
-
- -
-
- data table -
-
-
+ });// end onDomReady function + +
+
+ +
+
+ +
+
+ data table +
+
+
-
- + + diff --git a/crm/src/main/java/com/rex/crm/ActivityPage.html b/crm/src/main/java/com/rex/crm/ActivityPage.html index 3d19826..59e34ce 100755 --- a/crm/src/main/java/com/rex/crm/ActivityPage.html +++ b/crm/src/main/java/com/rex/crm/ActivityPage.html @@ -1,34 +1,38 @@ - - - - -
-
- -
-
- -
- data table + });// end onDomReady function + + +
+
+ +
+
+ +
+ data table +
-
-
- - - +
+ + + diff --git a/crm/src/main/java/com/rex/crm/ContactPage.html b/crm/src/main/java/com/rex/crm/ContactPage.html index c502438..4eeee89 100755 --- a/crm/src/main/java/com/rex/crm/ContactPage.html +++ b/crm/src/main/java/com/rex/crm/ContactPage.html @@ -1,35 +1,39 @@ - - - - -
-
- -
-
- + });// end onDomReady function + -
- data table +
+
+
-
-
- - - +
+ + +
+ data table +
+
+
+ + + diff --git a/crm/src/main/java/com/rex/crm/UserPage.html b/crm/src/main/java/com/rex/crm/UserPage.html index 7bdeb2e..efaa335 100755 --- a/crm/src/main/java/com/rex/crm/UserPage.html +++ b/crm/src/main/java/com/rex/crm/UserPage.html @@ -1,34 +1,38 @@ - - - - -
-
- -
-
- -
- data table + });// end onDomReady function + + +
+
+ +
+
+ +
+ data table +
-
-
- - - +
+ + + diff --git a/crm/src/main/java/com/rex/crm/common/TeamManPanel.html b/crm/src/main/java/com/rex/crm/common/TeamManPanel.html index c397b8e..690aef4 100644 --- a/crm/src/main/java/com/rex/crm/common/TeamManPanel.html +++ b/crm/src/main/java/com/rex/crm/common/TeamManPanel.html @@ -1,73 +1,70 @@ - + -
-
- -
-
- - - - - -
-
-   团队信息 -
-
-
- 添加 -
-
-
-
- - - - - - - - - - - -
- - - - - - - - -
-
-
-
- +
\ No newline at end of file diff --git a/crm/src/main/java/com/rex/crm/common/TeamManPanel.java b/crm/src/main/java/com/rex/crm/common/TeamManPanel.java index 4f23584..428fa65 100644 --- a/crm/src/main/java/com/rex/crm/common/TeamManPanel.java +++ b/crm/src/main/java/com/rex/crm/common/TeamManPanel.java @@ -101,10 +101,15 @@ public void onClick() { //set column name RepeatingView columnNameRepeater = new RepeatingView("columnNameRepeater"); add(columnNameRepeater); + int count=0; for(Field f:entity.getFields()){ if (!f.isVisible()|| f.getPriority() >1) continue; AbstractItem item = new AbstractItem(columnNameRepeater.newChildId()); + if(count==0){ + item.add(new AttributeAppender("class", new Model("table-first-link"), " ")); + count++; + } columnNameRepeater.add(item); item.add(new Label("columnName", f.getDisplay())); } @@ -148,6 +153,7 @@ public Serializable getObject() { if(value.equals("null")||value.equals("")||value.equals("dummy")){ value = "无"; } + columnitem.add(new AttributeAppender("class", new Model("table-first-link"), " ")); columnitem.add(new DetailLinkFragment("celldata","detailFragment",this,value)); } else { if (f.getPicklist() != null) { @@ -176,7 +182,8 @@ public Serializable getObject() { //add extra field in the last column AbstractItem columnitem = new AbstractItem(columnRepeater.newChildId(), new Model(rowId)); if(roleId == 1){ - columnitem.add(new ExtraFieldFragment("celldata","extraFieldFragment",this,"删除",type)); + columnitem.add(new ExtraFieldFragment("celldata","extraFieldFragment",this,"删除",type)); + columnitem.add(new AttributeAppender("class", new Model("table-first-link delete"), " ")); }else{ columnitem.add(new WebMarkupContainer("celldata")); } diff --git a/crm/src/main/webapp/css/extra.css b/crm/src/main/webapp/css/extra.css index 8e48dd6..01b5d43 100644 --- a/crm/src/main/webapp/css/extra.css +++ b/crm/src/main/webapp/css/extra.css @@ -87,7 +87,7 @@ a:hover, a:focus { } .btn-group-right{ float: right; - padding-right: 10px; + padding-right: 2px; } .table-title{ float: left; @@ -98,12 +98,17 @@ a:hover, a:focus { .table-custom-header{ padding: 0; width: 100%; +} +.label { + -webkit-border-radius: 0px; + -moz-border-radius: 0px; + border-radius: 0px; border-bottom: solid; - padding-bottom: 1px; - border-color: rgb(107, 166, 255); - box-sizing: border-box; + border-color: #3498DB; border-bottom-width: 2px; + box-sizing: border-box; height: 34px; + padding-top: 0px; } @media ( max-width : 767px) { /* Enable use of floated navbar text */ @@ -226,7 +231,7 @@ a:hover, a:focus { .btn-group-right{ width: 100%; float: initial; - padding-top: 10px; + padding-top: 5px; } .btn-group-right a{ width: 100%; @@ -241,9 +246,6 @@ a:hover, a:focus { .title > span{ padding-left: 0px; } - .table-custom-header{ - height: 74px; - } .table-title{ float: initial; } @@ -254,7 +256,17 @@ a:hover, a:focus { display: none; } .table-first-link{ - display: block + display: block; + } + .label{ + border-bottom: none; + height: 74px; + } + .delete{ + padding-right: 28px !important; + } + .delete a{ + width: 100%; } @-moz-document url-prefix() { .detailed { From 469f9d1e92a82b83b8f73b9d46b243512e6dc9a2 Mon Sep 17 00:00:00 2001 From: Brendacui Date: Wed, 23 Oct 2013 14:23:13 +0800 Subject: [PATCH 048/520] update coachDetail and score bar --- .../java/com/rex/crm/CreateEventPage.html | 94 +++++++++++++------ .../java/com/rex/crm/CreateEventPage.java | 20 +++- .../java/com/rex/crm/EventEditorPage.html | 64 ++++++------- .../com/rex/crm/common/EntityDetailPanel.html | 14 +++ .../com/rex/crm/common/EntityDetailPanel.java | 1 + crm/src/main/java/com/rex/crm/db/DAOImpl.java | 19 +++- crm/src/main/resources/entity.xml | 84 +++++++++++++++++ 7 files changed, 225 insertions(+), 71 deletions(-) diff --git a/crm/src/main/java/com/rex/crm/CreateEventPage.html b/crm/src/main/java/com/rex/crm/CreateEventPage.html index 36b7c7e..bc569ff 100755 --- a/crm/src/main/java/com/rex/crm/CreateEventPage.html +++ b/crm/src/main/java/com/rex/crm/CreateEventPage.html @@ -6,34 +6,36 @@ @@ -68,6 +98,12 @@
+
+ +
+ (此项可不填,若必填则自动拼接字符,如:拜访:李医生/主管2013-10-10拜访辅导) +
+