winix/functions/vim.cpp

102 lines
2.1 KiB
C++
Raw Normal View History

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* All rights reserved.
*
*/
#include "vim.h"
#include "functions.h"
namespace Fun
{
// WYMeditor doesn't work on different domains by default,
// solution: http://forum.wymeditor.org/forum/viewtopic.php?f=2&t=731&p=2507#p2504
// we add one file to winix: /var/wymiframe.html
// in the future this will be removed
static const char vim_wymiframe[] =
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
"<!--\n"
" * WYMeditor : what you see is What You Mean web-based editor\n"
" * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/\n"
" * Dual licensed under the MIT (MIT-license.txt)\n"
" * and GPL (GPL-license.txt) licenses.\n"
" *\n"
" * For further information visit:\n"
" * http://www.wymeditor.org/\n"
" *\n"
" * File Name:\n"
" * wymiframe.html\n"
" * Iframe used by designMode.\n"
" * See the documentation for more info.\n"
" *\n"
" * File Authors:\n"
" * Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)\n"
"-->\n"
"<html>\n"
"<head>\n"
"<title>WYMeditor iframe</title>\n"
"<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7\" />\n"
"<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"[doc_base_url_common]/wymeditor/iframe/default/wymiframe.css\" />\n"
"</head>\n"
"<body class=\"wym_iframe\"></body>\n"
"</html>\n";
Vim::Vim()
{
fun.url = "vim";
}
void Vim::Init()
{
Item * var = system->dirs.CreateVarDir();
if( var )
{
Item temp;
if( db->GetItem(var->id, "wymiframe.html", temp) == WINIX_ERR_NO_ITEM )
{
Item v;
v.parent_id = var->id;
v.user_id = -1;
v.group_id = -1;
v.privileges = 0755;
v.subject = "wymiframe.html";
v.url = "wymiframe.html";
v.type = Item::file;
v.content = vim_wymiframe;
v.content_type = Item::ct_raw;
system->AddFile(v, false);
}
}
}
bool Vim::HasAccess()
{
return functions->fun_emacs.HasAccess();
}
void Vim::MakePost()
{
functions->fun_emacs.MakePost();
}
} // namespace