Menu

[r103]: / cms / trunk / views.h  Maximize  Restore  History

Download this file

129 lines (115 with data), 2.4 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
//
// C++ Implementation: views
//
// Description:
//
//
// Author: artik <artik@art-laptop>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef VIEWS_H
#define VIEWS_H
#include <cppcms/templates.h>
#include <boost/shared_ptr.hpp>
#include "data.h"
#include <list>
#include <vector>
using boost::shared_ptr;
class Blog;
class View_Comment {
Blog *blog;
string author;
string url;
string message;
string date;
public:
View_Comment(Blog *b) { blog=b; };
void init(comment_t &c);
int render(Renderer &r,Content &c, string &out);
};
class View_Post {
friend class View_Main_Page;
Blog *blog;
int id;
string title;
string permlink;
string author;
string abstract;
string content;
string date;
bool has_content;
string post_comment1;
string post_comment2;
bool has_comments;
list<shared_ptr<View_Comment> > comments_list;
void ini_share(post_t &p);
public:
View_Post(Blog *b) { blog=b; };
void ini_feed(post_t &p);
void ini_short(post_t &p);
void ini_full(post_t &p);
int render(Renderer &r,Content &c, string &out);
};
class View_Main_Page {
Blog *blog;
string title;
string description;
shared_ptr<View_Post> single_post;
vector<shared_ptr<View_Post> > latest_posts;
string from;
enum { SUMMARY, SINGLE, ERROR } disp;
int error_code;
void ini_share();
public:
View_Main_Page(Blog *blog)
{
this->blog=blog;
};
void ini_post(int id);
void ini_main(int id=-1);
void ini_error(int what);
int render(Renderer &r,Content &c, string &out);
};
class View_Admin_Post {
Blog *blog;
string title;
string post_url;
string post_id;
string abstract;
string content;
string preview;
public:
View_Admin_Post(Blog *b) : blog(b) {};
void ini(int id=-1);
int render(Renderer &r,Content &c, string &out);
};
class View_Admin_Main
{
Blog *blog;
struct post_ref {
string title;
string edit_url;
};
list<post_ref> unpublished_posts;
public:
View_Admin_Main(Blog *b): blog(b){};
void ini();
int render(Renderer &r,Content &c, string &out);
};
class View_Admin {
Blog *blog;
string blog_name;
enum { MAIN, POST, LOGIN} page;
void ini_share();
shared_ptr<View_Admin_Post> post;
shared_ptr<View_Admin_Main> main;
public:
View_Admin(Blog *b) : blog(b) {};
void ini_main();
void ini_edit(int id=-1);
void ini_login();
int render(Renderer &r,Content &c, string &out);
};
#endif
MongoDB Logo MongoDB