~cipmap-devs/cipmap/add-status-page

« back to all changes in this revision

Viewing changes to src/cm-web.h

  • Committer: Noya
  • Date: 2008-10-04 13:19:05 UTC
  • Revision ID: kalterregen@gmx.net-20081004131905-1meno5e4nbdooi01
dynamic loading of xhtml-templates implemented
added tuple type
added web-components CmPage, CmHeader, CmFooter, CmMenu and CmContent
added functions for filling templates with data
website-creation is now implemented via templates

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2008, CIPmap-authors
 
3
 * All rights reserved.
 
4
 *
 
5
 * Redistribution and use in source and binary forms, with or without
 
6
 * modification, are permitted provided that the following conditions are met:
 
7
 *
 
8
 *     * Redistributions of source code must retain the above copyright notice,
 
9
 *       this list of conditions and the following disclaimer.
 
10
 *     * Redistributions in binary form must reproduce the above copyright
 
11
 *       notice, this list of conditions and the following disclaimer in the
 
12
 *       documentation and/or other materials provided with the distribution.
 
13
 *     * The names of CIPmap's contributors may not be used to endorse or
 
14
 *       promote products derived from this software without specific prior
 
15
 *       written permission.
 
16
 * 
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 
18
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
20
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 
21
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 
22
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 
23
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 
24
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 
25
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 
26
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
27
 * POSSIBILITY OF SUCH DAMAGE.
 
28
 */
 
29
 
 
30
#ifndef CM_WEB_H
 
31
#define CM_WEB_H
 
32
 
 
33
#include "cm-map.h"
 
34
 
 
35
#include <glib.h>
 
36
 
 
37
typedef struct CmTuple_ CmTuple;
 
38
 
 
39
typedef struct CmPage_      CmPage;
 
40
typedef struct CmHeader_    CmHeader;
 
41
typedef struct CmFooter_    CmFooter;
 
42
typedef struct CmMenu_      CmMenu;
 
43
typedef struct CmContent_   CmContent;
 
44
 
 
45
struct CmTuple_ {
 
46
    gpointer a;
 
47
    gpointer b;
 
48
};
 
49
 
 
50
struct CmPage_ {
 
51
    CmHeader *header;
 
52
    CmFooter *footer;
 
53
    CmMenu *menu;
 
54
    CmContent *content;
 
55
};
 
56
 
 
57
struct CmHeader_ {
 
58
    const gchar *templ;
 
59
    gchar *title;
 
60
};
 
61
 
 
62
struct CmFooter_ {
 
63
    const gchar *templ;
 
64
};
 
65
 
 
66
struct CmMenu_ {
 
67
    const gchar *templ;
 
68
    gchar *selected;
 
69
    gchar *submenu;
 
70
};
 
71
 
 
72
struct CmContent_ {
 
73
    gchar *html;
 
74
};
 
75
 
 
76
CmTuple *cm_tuple_new(gpointer a, gpointer b);
 
77
void cm_tuple_free(CmTuple *tuple);
 
78
void cm_tuple_init(CmTuple *tuple, gpointer a, gpointer b);
 
79
 
 
80
CmPage *cm_page_new(void);
 
81
void cm_page_free(CmPage *page);
 
82
gchar *cm_page_to_html(CmPage *page);
 
83
gboolean cm_page_write_to_file(CmPage *page, const gchar *file,
 
84
                               GError **error);
 
85
 
 
86
CmHeader *cm_header_new(void);
 
87
void cm_header_free(CmHeader *header);
 
88
gchar *cm_header_to_html(CmHeader *header);
 
89
 
 
90
CmFooter *cm_footer_new(void);
 
91
void cm_footer_free(CmFooter *footer);
 
92
gchar *cm_footer_to_html(CmFooter *footer);
 
93
 
 
94
CmMenu *cm_menu_new(void);
 
95
void cm_menu_free(CmMenu *menu);
 
96
gchar *cm_menu_to_html(CmMenu *menu);
 
97
 
 
98
CmContent *cm_content_new(void);
 
99
void cm_content_free(CmContent *content);
 
100
gchar *cm_content_to_html(CmContent *content);
 
101
 
 
102
gboolean cm_web_init(void);
 
103
 
 
104
void cm_web_create_all(void);
 
105
void cm_web_create_map(CmPage *page, CmMap *map);
 
106
 
 
107
const gchar *cm_templ_get(const gchar *name);
 
108
 
 
109
gchar *cm_templ_fill_list(const gchar *templ, GList *key_value_pairs);
 
110
gchar *cm_templ_fill(const gchar *templ, ...);
 
111
 
 
112
#endif