Anonymous avatar Anonymous committed 41288f4

It is now possible to not export neither validate nor dataflow function; the form builder now skips the unnecessery fields

Comments (0)

Files changed (8)

lib/eptic-1.3/priv/errors.conf

 {bad_time_format, "The time is badly formatted"}.
 {bad_separator_in_time_form, "Bad separator in time form"}.
 {bad_extension, "The file has bad extension"}.
-{too_big, "The file is too big"}.
+{too_big, "The file is too big"}.
+{empty_input, "The input could not be empty"}.

lib/eptic-1.3/src/e_mod_gen.erl

 	    e_logger:log({?MODULE, {entering_dataflow_for, {Mod, Fun}}}),
 	    Answ = apply(Mod, dataflow, [Fun]),
 	    controller_handler(Answ, {Mod,Fun,View});
-	_ ->
-	    e_logger:log({?MODULE, {skipping_dataflow, entering_validate, {Mod, Fun}}}),
-	    {ok, ValidArgs} = apply(Mod, validate, [Fun]),
-	    Ret = apply(Mod, Fun, ValidArgs),
-	    e_logger:log({?MODULE, {controller_response, Ret}}),
-	    {ret_view, Ret, View}
+	false ->
+	    case lists:member({validate, 1}, Funs) of
+		true ->
+		    e_logger:log({?MODULE, {skipping_dataflow, entering_validate, {Mod, Fun}}}),
+		    {ok, ValidArgs} = apply(Mod, validate, [Fun]),
+		    Ret = apply(Mod, Fun, ValidArgs),
+		    e_logger:log({?MODULE, {controller_response, Ret}}),
+
+		    {ret_view, Ret, View};
+		false ->
+		    e_logger:log({?MODULE, {skipping_dataflow_and_validate, entering_directly, {Mod, Fun}}}),
+		    Ret = apply(Mod, Fun, [get_dataflow_initial_args()]),
+		    e_logger:log({?MODULE, {controller_response, Ret}}),
+		    
+		    {ret_view, Ret, View}
+	    end
     end.
 
 -spec(controller_handler/2 :: ({list(atom()), list(atom())} | list(atom()), {atom(), atom(), string()}) ->

lib/wparts-1.3/priv/html/div_item.tpl

 <div id="<% id %>" class="form_entry">
      <label for="<% id %>"><% description %>
-     	    <span class="form_error" id="<% id %>_error"><% error %></span>
-	    <span class="form_comment" id="<% id %>_comment"><% comment %></span>
+     	    <% error %>
+	    <% comment %>
      </label>
      <span class="form_input"><% input %></span>
 </div>

lib/wparts-1.3/priv/html/list_item.tpl

 <li id="<% id %>" class="form_entry">
      <label for="<% id %>"><% description %>
-     	    <span class="form_error" id="<% id %>_error"><% error %></span>
-	    <span class="form_comment" id="<% id %>_comment"><% comment %></span>
+     	    <% error %>
+	    <% comment %>
      </label>
      <span class="form_input"><% input %></span>
 </li>

lib/wparts-1.3/priv/html/paragraph_item.tpl

 <p id="<% id %>" class="form_entry">
      <label for="<% id %>"><% description %>
-     	    <span class="form_error" id="<% id %>_error"><% error %></span>
-	    <span class="form_comment" id="<% id %>_comment"><% comment %></span>
+     	    <% error %>
+	    <% comment %>
      </label>
      <span class="form_input"><% input %></span>
 </p>

lib/wparts-1.3/priv/html/span.tpl

+<span <% html %>> <% content %> </span>

lib/wparts-1.3/priv/html/table_item.tpl

 </tr>
 <tr>
 	<td>
-		<span class="form_comment" id="<% id %>_comment"> <% comment %></span>
-		<span class="form_error" id="<% id %>_error"> <% error %></span>
+		<% comment %>
+		<% error %>
 	</td>
 </tr>

lib/wparts-1.3/src/wpart_derived.erl

     case wpartlib:has_attribute("attribute::type", E) of
 	false -> 
 	    error_logger:error_msg("~p module, error during processing the handle_call/1 function.~n"
-				   "wpart:derived tag must have the type attribute~n~n"),
+				   "wpart:derived tag must have the type attribute~n~n",
+				   [?MODULE]),
 	    #xmlText{value=""};
 	Type -> 
 	    FormType = case wpartlib:has_attribute("attribute::form_type", E) of
     Module = list_to_atom("wpart_" ++ atom_to_list(Type)),
     LName = generate_long_name(Prefix, Name),
     Input = Module:build_html_tag(LName, Params, find(LName, Defaults)),
+    Span = wpart_gen:tpl_get(span),
+
+    Proplist0 = [{"id", LName}, {"input", Input}, {"description", get_description(Params)}],
+    Proplist1 = case e_error:description(LName) of
+		    [] ->
+			Proplist0;
+		    ErrorDesc ->
+			[{"error", wpart_gen:build_html(Span, [{"content", ErrorDesc},
+							       {"id", LName ++ "_error"},
+							       {"class", "form_error"}])}
+			 | Proplist0]
+		end,
+    Proplist = case get_comment(Params) of
+		   [] ->
+		       Proplist1;
+		   CommentDesc ->
+		       [{"comment", wpart_gen:build_html(Span, [{"content", CommentDesc},
+								{"id", LName ++ "_comment"},
+								{"class", "form_comment"}])}
+			| Proplist1]
+	       end,
 
     wpart_gen:build_html(wpart_gen:tpl_get(form_type(FormType)), 
-			 [{"id", LName},
-			  {"error", e_error:description(LName)},
-			  {"description", get_description(Params)},
-			  {"comment", get_comment(Params)},
-			  {"input", Input}]).
+			 Proplist).
 
 -spec(build_html_tag/4 :: (atom(), atom(), string(), list()) -> string()).	     
 build_html_tag(Type, _Name, Prefix, _Params) ->
 		       filename:join([code:priv_dir(wparts),"html","list_item.tpl"])),
     
     wpart_gen:load_tpl(div_item, 
-		       filename:join([code:priv_dir(wparts),"html","div_item.tpl"])).
+		       filename:join([code:priv_dir(wparts),"html","div_item.tpl"])),
+    
+    wpart_gen:load_tpl(span, 
+		       filename:join([code:priv_dir(wparts),"html","span.tpl"])).
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.