+} elsif ($q->path_info =~ m#template#) {
+
+ my $template_path = $out->{'include_path'} . '/' . $template_filename;
+
+ if ($q->param('save_template')) {
+
+ update_file($template_path, $q->param('tt_template'));
+
+ print qq{<response>
+<action type='html' target='div_template_status' errorCode='' errorMessage='' >
+<tt>$template_filename</tt> saved
+</action>
+<action type='js'>
+<!--
+iwfShow('div_template_status', 1);
+reload_rec();
+iwfHideGentlyDelay('div_template_status', 2, 2000, 1);
+-->
+</action>
+</response>
+ };
+ exit;
+
+ }
+
+ my $tmpl = get_file_in_html($template_path);
+
+ print qq{<response>
+<action type='html' target='div_template' errorCode='' errorMessage='' >
+
+<form name="frmEditor" action="$self" method="post" iwfTarget="div_template_status" >
+
+<textarea name="tt_template" cols="80" rows="10" style="display: block;">
+$tmpl
+</textarea>
+
+<br/>
+<input type="button" name="save_template" value="Save" onclick="javascript:iwfRequest(this);" />
+<!--
+<input type="checkbox" name="checkin_template" id="checkin_checkbox" label="checkin" /> checkin
+-->
+ <span id="div_template_status" style="color: #808080;">idle</span>
+
+<input type='hidden' value='hidden post value' name='hidValue' />
+
+</form>
+</action>
+<action type='js'>
+<!--
+iwfHideGentlyDelay('div_template_status', 2, 2000, 1);
+-->
+</action>
+</response>
+ };
+
+ exit;
+
+} elsif ($q->path_info =~ m#css#) {
+
+ my $css_path = $abs_path . '/web/' . $css_file;
+
+
+ if ($q->param('save_css')) {
+ update_file($css_path, $q->param('user_css'));
+
+ print qq{<response>
+<action type='html' target='div_css_status' errorCode='' errorMessage='' >
+<tt>$css_file</tt> saved
+</action>
+<action type='js'>
+<!--
+iwfShow('div_css_status', 1);
+// switch css
+css_rnd++;
+iwfLog('loading user.css?'+css_rnd);
+iwfGetById('user_css_link').href = 'user.css?'+css_rnd;
+iwfHideGentlyDelay('div_css_status', 2, 2000, 1);
+-->
+</action>
+</response>
+ };
+ exit;
+
+ }
+
+ my $user_css = get_file_in_html($css_path);
+
+ print qq{<response>
+<action type='html' target='div_css' errorCode='' errorMessage='' >
+
+<form name="frmCSSEditor" action="$self" method="post" iwfTarget="div_css_status" >
+
+<textarea name="user_css" cols="80" rows="10" style="display: block; width: 100%;">
+$user_css
+</textarea>
+
+<br/>
+<input type="button" name="save_css" value="Save" onclick="javascript:iwfRequest(this);" />
+ <span id="div_css_status" style="color: #808080;">idle</span>
+</form>
+</action>
+<action type='js'>
+<!--
+iwfLog('loaded CSS template');
+-->
+</action>
+</response>
+ };
+
+ exit;
+