| 2278 | |
| 2279 | |
| 2280 | int ph_build_header(str *page, int max_page_len, int mod, int cmd) |
| 2281 | { |
| 2282 | int i; |
| 2283 | char *p, *buf; |
| 2284 | ph_mod_t *ph_modules; |
| 2285 | |
| 2286 | ph_modules = ph_framework_data->ph_modules; |
| 2287 | if (page->s == NULL) { |
| 2288 | LM_ERR("Please provide a valid page\n"); |
| 2289 | return -1; |
| 2290 | } |
| 2291 | p = buf = page->s; |
| 2292 | |
| 2293 | PI_HTTP_COPY_4(p,PI_HTTP_Response_Head_1, |
| 2294 | PI_HTTP_Response_Head_2, |
| 2295 | PI_HTTP_Response_Title_Table_1, |
| 2296 | PI_HTTP_Response_Title_Table_3); |
| 2297 | /* Building module menu */ |
| 2298 | PI_HTTP_COPY(p,PI_HTTP_Response_Menu_Table_1); |
| 2299 | for(i=0;i<ph_framework_data->ph_modules_size;i++) { |
| 2300 | if(i!=mod) { |
| 2301 | PI_HTTP_COPY(p,PI_HTTP_Response_Menu_Table_2); |
| 2302 | } else { |
| 2303 | PI_HTTP_COPY(p,PI_HTTP_Response_Menu_Table_2b); |
| 2304 | } |
| 2305 | PI_HTTP_COPY(p,PI_HTTP_SLASH); |
| 2306 | if (http_root.len) { |
| 2307 | PI_HTTP_COPY_2(p,http_root,PI_HTTP_SLASH); |
| 2308 | } |
| 2309 | PI_HTTP_COPY_3(p,ph_modules[i].module, |
| 2310 | PI_HTTP_Response_Menu_Table_3, |
| 2311 | ph_modules[i].module); |
| 2312 | if(i!=mod) { |
| 2313 | PI_HTTP_COPY(p,PI_HTTP_Response_Menu_Table_4); |
| 2314 | } else { |
| 2315 | PI_HTTP_COPY(p,PI_HTTP_Response_Menu_Table_4b); |
| 2316 | } |
| 2317 | } |
| 2318 | PI_HTTP_COPY(p,PI_HTTP_Response_Menu_Table_5); |
| 2319 | |
| 2320 | page->len = p - page->s; |
| 2321 | return 0; |
| 2322 | error: |
| 2323 | LM_ERR("buffer 2 small\n"); |
| 2324 | page->len = p - page->s; |
| 2325 | return -1; |
| 2326 | } |
| 2327 | |
| 2328 | |
| 2329 | |