GValue *val;
gchar *filename;
+ gint id;
ZakFormCgiForm *form;
"<div class=\"container\">\n");
val = zak_cgi_main_get_parameter (zakcgimain, "filename");
- filename = (gchar *)g_value_get_string (val);
+ if (val != NULL)
+ {
+ filename = (gchar *)g_value_get_string (val);
+ }
+ else
+ {
+ filename = g_strdup ("");
+ }
+
+ val = zak_cgi_main_get_parameter (zakcgimain, "id");
+ if (val != NULL)
+ {
+ id = strtol (g_value_get_string (val), NULL, 10);
+ }
+ else
+ {
+ id = 0;
+ }
form = zak_form_cgi_form_new (zakcgimain,
"method", "post",
{
if (zak_cgi_main_is_post (zakcgimain))
{
- sleep(10);
/* validating the form */
zak_form_cgi_form_bind (form);
if (zak_form_form_is_valid (ZAK_FORM_FORM (form)))
else
{
zak_form_form_clear (ZAK_FORM_FORM (form));
+ if (id > 0)
+ {
+ zak_form_element_set_value (zak_form_form_get_element_by_id (ZAK_FORM_FORM (form), "id"), g_strdup_printf ("%d", id));
+
+ provider = zak_form_ini_provider_new_from_file (filename);
+ if (provider != NULL)
+ {
+ zak_form_form_load (ZAK_FORM_FORM (form), ZAK_FORM_IPROVIDER (provider));
+ g_object_unref (provider);
+ }
+ }
g_string_append (str, zak_form_cgi_form_render (form));
}
}