Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
a012fdb54c
9
patches/march_2013/p03_rename_blog_to_blog_post.py
Normal file
9
patches/march_2013/p03_rename_blog_to_blog_post.py
Normal file
@ -0,0 +1,9 @@
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc('website', 'doctype', 'blogger')
|
||||
webnotes.rename_doc("DocType", "Blog", "Blog Post", force=True)
|
||||
webnotes.reload_doc('website', 'doctype', 'blog_post')
|
||||
webnotes.conn.sql('''update tabBlogger set posts=(select count(*)
|
||||
from `tabBlog Post` where ifnull(blogger,"")=tabBlogger.name)''')
|
||||
webnotes.conn.sql("""update `tabBlog Post` set published_on=creation""")
|
@ -210,5 +210,6 @@ patch_list = [
|
||||
"execute:webnotes.conn.sql('update tabDocPerm set `submit`=1, `cancel`=1, `amend`=1 where parent=\"Time Log\"')",
|
||||
"execute:webnotes.delete_doc('DocType', 'Attendance Control Panel')",
|
||||
"patches.march_2013.p02_get_global_default",
|
||||
"execute:webnotes.bean('Style Settings', 'Style Settings').save()"
|
||||
"execute:webnotes.bean('Style Settings', 'Style Settings').save()",
|
||||
"patches.march_2013.p03_rename_blog_to_blog_post",
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,12 +0,0 @@
|
||||
[
|
||||
"Website",
|
||||
"Content",
|
||||
"Title",
|
||||
"Blog Intro",
|
||||
"Page Name",
|
||||
"Blog",
|
||||
"Email Sent",
|
||||
"File List",
|
||||
"Published",
|
||||
"Description for listing page, in plain text, only a couple of lines."
|
||||
]
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"Blog": "\u0628\u0644\u0648\u0642",
|
||||
"Content": "\u0645\u062d\u062a\u0648\u0649",
|
||||
"Email Sent": "\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0625\u0644\u0643\u062a\u0631\u0648\u0646\u064a",
|
||||
"File List": "\u0645\u0644\u0641 \u0642\u0627\u0626\u0645\u0629",
|
||||
"Page Name": "\u0627\u0644\u0635\u0641\u062d\u0629 \u0627\u0633\u0645",
|
||||
"Published": "\u0646\u0634\u0631\u062a",
|
||||
"Title": "\u0644\u0642\u0628",
|
||||
"Website": "\u0627\u0644\u0645\u0648\u0642\u0639"
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"Blog": "Blog",
|
||||
"Content": "Inhalt",
|
||||
"Email Sent": "E-Mail gesendet",
|
||||
"File List": "Dateiliste",
|
||||
"Page Name": "Page Name",
|
||||
"Published": "Ver\u00f6ffentlicht",
|
||||
"Title": "Titel",
|
||||
"Website": "Webseite"
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"Blog": "Blog",
|
||||
"Content": "Contenido",
|
||||
"Email Sent": "Correo electr\u00f3nico enviado",
|
||||
"File List": "Lista de archivos",
|
||||
"Page Name": "Nombre p\u00e1gina",
|
||||
"Published": "Publicado",
|
||||
"Title": "T\u00edtulo",
|
||||
"Website": "Sitio web"
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"Blog": "Blog",
|
||||
"Content": "Teneur",
|
||||
"Email Sent": "Courriel a \u00e9t\u00e9 envoy\u00e9",
|
||||
"File List": "Liste des fichiers",
|
||||
"Page Name": "Nom de la page",
|
||||
"Published": "Publi\u00e9",
|
||||
"Title": "Titre",
|
||||
"Website": "Site Web"
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"Blog": "\u092c\u094d\u0932\u0949\u0917",
|
||||
"Content": "\u0938\u093e\u092e\u0917\u094d\u0930\u0940",
|
||||
"Email Sent": "\u0908\u092e\u0947\u0932 \u092d\u0947\u091c\u093e \u0917\u092f\u093e",
|
||||
"File List": "\u092b\u093c\u093e\u0907\u0932 \u0938\u0942\u091a\u0940",
|
||||
"Page Name": "\u092a\u0947\u091c \u0915\u093e \u0928\u093e\u092e",
|
||||
"Published": "\u092a\u094d\u0930\u0915\u093e\u0936\u093f\u0924",
|
||||
"Title": "\u0936\u0940\u0930\u094d\u0937\u0915",
|
||||
"Website": "\u0935\u0947\u092c\u0938\u093e\u0907\u091f"
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"Blog": "Blog",
|
||||
"Content": "Sadr\u017eaj",
|
||||
"Email Sent": "E-mail poslan",
|
||||
"File List": "Popis datoteka",
|
||||
"Page Name": "Stranica Ime",
|
||||
"Published": "Objavljen",
|
||||
"Title": "Naslov",
|
||||
"Website": "Website"
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"Blog": "Blog",
|
||||
"Content": "Inhoud",
|
||||
"Email Sent": "E-mail verzonden",
|
||||
"File List": "File List",
|
||||
"Page Name": "Page Name",
|
||||
"Published": "Gepubliceerd",
|
||||
"Title": "Titel",
|
||||
"Website": "Website"
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"Blog": "Blog",
|
||||
"Blog Intro": "Blog Intro",
|
||||
"Content": "Conte\u00fado",
|
||||
"Description for listing page, in plain text, only a couple of lines.": "Descri\u00e7\u00e3o p\u00e1gina de listagem, em texto simples, apenas um par de linhas.",
|
||||
"Email Sent": "E-mail enviado",
|
||||
"File List": "Lista de Arquivos",
|
||||
"Page Name": "Nome da P\u00e1gina",
|
||||
"Published": "Publicado",
|
||||
"Title": "T\u00edtulo",
|
||||
"Website": "Site"
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"Blog": "Blog",
|
||||
"Content": "Conte\u00fado",
|
||||
"Email Sent": "E-mail enviado",
|
||||
"File List": "Lista de Arquivos",
|
||||
"Page Name": "Nome da P\u00e1gina",
|
||||
"Published": "Publicado",
|
||||
"Title": "T\u00edtulo",
|
||||
"Website": "Site"
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"Blog": "\u0411\u043b\u043e\u0433",
|
||||
"Content": "\u0421\u0430\u0434\u0440\u0436\u0438\u043d\u0430",
|
||||
"Email Sent": "\u0415\u043c\u0430\u0438\u043b \u0421\u0435\u043d\u0442",
|
||||
"File List": "\u0424\u0438\u043b\u0435 \u041b\u0438\u0441\u0442",
|
||||
"Page Name": "\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0418\u043c\u0435",
|
||||
"Published": "\u041e\u0431\u0458\u0430\u0432\u0459\u0435\u043d",
|
||||
"Title": "\u041d\u0430\u0441\u043b\u043e\u0432",
|
||||
"Website": "\u0412\u0435\u0431\u0441\u0430\u0458\u0442"
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"Blog": "\u0bb5\u0bb2\u0bc8\u0baa\u0bcd\u0baa\u0ba4\u0bbf\u0bb5\u0bc1",
|
||||
"Content": "\u0b89\u0bb3\u0bcd\u0bb3\u0b9f\u0b95\u0bcd\u0b95\u0bae\u0bcd",
|
||||
"Email Sent": "\u0bae\u0bbf\u0ba9\u0bcd\u0ba9\u0b9e\u0bcd\u0b9a\u0bb2\u0bcd \u0b85\u0ba9\u0bc1\u0baa\u0bcd\u0baa\u0baa\u0bcd\u0baa\u0b9f\u0bcd\u0b9f\u0ba4\u0bc1",
|
||||
"File List": "\u0b95\u0bc7\u0bbe\u0baa\u0bcd\u0baa\u0bc1 \u0baa\u0b9f\u0bcd\u0b9f\u0bbf\u0baf\u0bb2\u0bcd",
|
||||
"Page Name": "\u0baa\u0b95\u0bcd\u0b95\u0bae\u0bcd \u0baa\u0bc6\u0baf\u0bb0\u0bcd",
|
||||
"Published": "\u0bb5\u0bc6\u0bb3\u0bbf\u0baf\u0bbf\u0b9f\u0baa\u0bcd\u0baa\u0b9f\u0bcd\u0b9f",
|
||||
"Title": "\u0ba4\u0bb2\u0bc8\u0baa\u0bcd\u0baa\u0bc1",
|
||||
"Website": "\u0b87\u0ba3\u0bc8\u0baf\u0ba4\u0bb3\u0bae\u0bcd"
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"Blog": "\u0e1a\u0e25\u0e47\u0e2d\u0e01",
|
||||
"Content": "\u0e40\u0e19\u0e37\u0e49\u0e2d\u0e2b\u0e32",
|
||||
"Email Sent": "\u0e2d\u0e35\u0e40\u0e21\u0e25\u0e17\u0e35\u0e48\u0e2a\u0e48\u0e07",
|
||||
"File List": "\u0e23\u0e32\u0e22\u0e0a\u0e37\u0e48\u0e2d\u0e44\u0e1f\u0e25\u0e4c",
|
||||
"Page Name": "\u0e0a\u0e37\u0e48\u0e2d\u0e40\u0e1e\u0e08",
|
||||
"Published": "\u0e40\u0e1c\u0e22\u0e41\u0e1e\u0e23\u0e48",
|
||||
"Title": "\u0e0a\u0e37\u0e48\u0e2d\u0e40\u0e23\u0e37\u0e48\u0e2d\u0e07",
|
||||
"Website": "\u0e40\u0e27\u0e47\u0e1a\u0e44\u0e0b\u0e15\u0e4c"
|
||||
}
|
0
website/doctype/blog_post/__init__.py
Normal file
0
website/doctype/blog_post/__init__.py
Normal file
@ -32,9 +32,14 @@ class DocType:
|
||||
if self.doc.blog_intro:
|
||||
self.doc.blog_intro = self.doc.blog_intro[:140]
|
||||
|
||||
# update posts
|
||||
webnotes.conn.sql("""update tabBlogger set posts=(select count(*) from `tabBlog Post`
|
||||
where ifnull(blogger,'')=tabBlogger.name)
|
||||
where name=%s""", self.doc.blogger)
|
||||
|
||||
def on_update(self):
|
||||
from website.utils import update_page_name
|
||||
update_page_name(self.doc, self.doc.title)
|
||||
website.utils.update_page_name(self.doc, self.doc.title)
|
||||
website.utils.delete_page_cache("writers")
|
||||
|
||||
def send_emails(self):
|
||||
"""send emails to subscribers"""
|
||||
@ -45,8 +50,8 @@ class DocType:
|
||||
import webnotes.utils
|
||||
|
||||
# get leads that are subscribed to the blog
|
||||
recipients = [e[0] for e in webnotes.conn.sql("""select distinct email_id from tabLead where
|
||||
ifnull(blog_subscriber,0)=1""")]
|
||||
recipients = [e[0] for e in webnotes.conn.sql("""select distinct email_id from
|
||||
tabLead where ifnull(blog_subscriber,0)=1""")]
|
||||
|
||||
# make heading as link
|
||||
content = '<h2><a href="%s/%s.html">%s</a></h2>\n\n%s' % (webnotes.utils.get_request_site_address(),
|
||||
@ -88,7 +93,7 @@ class DocType:
|
||||
|
||||
comment_list = webnotes.conn.sql("""\
|
||||
select comment, comment_by_fullname, creation
|
||||
from `tabComment` where comment_doctype="Blog"
|
||||
from `tabComment` where comment_doctype="Blog Post"
|
||||
and comment_docname=%s order by creation""", self.doc.name, as_dict=1)
|
||||
|
||||
self.doc.comment_list = comment_list or []
|
@ -1,13 +1,14 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-25 11:35:09",
|
||||
"creation": "2013-03-08 11:36:50",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-08 09:41:37",
|
||||
"modified": "2013-03-11 15:23:21",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"allow_attach": 1,
|
||||
"allow_import": 1,
|
||||
"doctype": "DocType",
|
||||
"max_attachments": 5,
|
||||
"module": "Website",
|
||||
@ -16,7 +17,7 @@
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Blog",
|
||||
"parent": "Blog Post",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
@ -24,7 +25,7 @@
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Blog",
|
||||
"parent": "Blog Post",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
@ -34,7 +35,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Blog"
|
||||
"name": "Blog Post"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -49,6 +50,12 @@
|
||||
"fieldtype": "Check",
|
||||
"label": "Published"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "published_on",
|
||||
"fieldtype": "Date",
|
||||
"label": "Published On"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break_3",
|
@ -9,10 +9,14 @@ class DocType:
|
||||
|
||||
def on_update(self):
|
||||
"if profile is set, then update all older blogs"
|
||||
|
||||
from website.helpers.blog import clear_blog_cache
|
||||
clear_blog_cache()
|
||||
|
||||
if self.doc.profile:
|
||||
for blog in webnotes.conn.sql_list("""select name from tabBlog where owner=%s
|
||||
for blog in webnotes.conn.sql_list("""select name from `tabBlog Post` where owner=%s
|
||||
and ifnull(blogger,'')=''""", self.doc.profile):
|
||||
b = webnotes.bean("Blog", blog)
|
||||
b = webnotes.bean("Blog Post", blog)
|
||||
b.doc.blogger = self.doc.name
|
||||
b.save()
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-03-07 16:28:19",
|
||||
"creation": "2013-03-08 11:36:52",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 16:33:37",
|
||||
"modified": "2013-03-11 14:00:37",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -73,6 +73,13 @@
|
||||
"label": "Avatar",
|
||||
"options": "attach_files:"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "posts",
|
||||
"fieldtype": "Int",
|
||||
"label": "Posts",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "file_list",
|
||||
|
@ -73,7 +73,7 @@ div.web-footer {
|
||||
.navbar-inverse .nav > li > a:hover,
|
||||
.navbar-inverse .brand:focus,
|
||||
.navbar-inverse .nav > li > a:focus {
|
||||
color: #{{ doc.top_bar_foreground or "fff"}};
|
||||
color: #{{ doc.top_bar_background or "aaa"}};
|
||||
}
|
||||
|
||||
.navbar-inverse .brand {
|
||||
@ -136,7 +136,7 @@ div.web-footer {
|
||||
border-bottom-color: #{{ doc.top_bar_background or "000"}};
|
||||
}
|
||||
|
||||
.navbar-inverse .nav li.dropdown.open > .dropdown-toggle,
|
||||
.navbar-inverse .nav li.dropdown.open > .dropdown-toggle {
|
||||
color: #{{ doc.top_bar_background or "000"}};
|
||||
background-color: #{{ doc.top_bar_foreground or "fff"}};
|
||||
}
|
||||
@ -147,9 +147,26 @@ div.web-footer {
|
||||
background-color: #{{ doc.top_bar_background or "000"}};
|
||||
color: #{{ doc.top_bar_foreground or "fff"}};
|
||||
}
|
||||
.navbar-inverse .nav-collapse .nav > li > a:hover,
|
||||
.navbar-inverse .nav-collapse .nav > li > a:hover,
|
||||
.navbar-inverse .nav-collapse .dropdown-menu a:hover {
|
||||
background-color: #{{ doc.top_bar_foreground or "fff"}};
|
||||
color: #{{ doc.top_bar_background or "000"}};
|
||||
}
|
||||
|
||||
.navbar-inverse .nav li.dropdown > .dropdown-toggle .caret {
|
||||
border-top-color: #{{ doc.top_bar_foreground or "fff" }};
|
||||
border-bottom-color: #{{ doc.top_bar_foreground or "fff" }};
|
||||
}
|
||||
|
||||
.navbar-inverse .nav li.dropdown > .dropdown-toggle:hover .caret {
|
||||
border-top-color: #{{ doc.top_bar_background or "000" }};
|
||||
border-bottom-color: #{{ doc.top_bar_background or "000" }};
|
||||
}
|
||||
|
||||
.navbar-inverse .nav li.dropdown.open > .dropdown-toggle .caret,
|
||||
.navbar-inverse .nav li.dropdown.open > .dropdown-toggle:hover .caret {
|
||||
border-top-color: #{{ doc.top_bar_background or "000" }};
|
||||
border-bottom-color: #{{ doc.top_bar_background or "000" }};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,13 @@ import webnotes
|
||||
import website.utils
|
||||
from webnotes import _
|
||||
|
||||
def clear_blog_cache():
|
||||
for blog in webnotes.conn.sql_list("""select page_name from
|
||||
`tabBlog Post` where ifnull(published,0)=1"""):
|
||||
website.utils.delete_page_cache(blog)
|
||||
|
||||
website.utils.delete_page_cache("writers")
|
||||
|
||||
@webnotes.whitelist(allow_guest=True)
|
||||
def get_blog_list(start=0, by=None, category=None):
|
||||
import webnotes
|
||||
@ -16,17 +23,17 @@ def get_blog_list(start=0, by=None, category=None):
|
||||
condition += " and t1.blog_category='%s'" % category.replace("'", "\'")
|
||||
query = """\
|
||||
select
|
||||
t1.title, t1.name, t1.page_name, t1.creation as creation,
|
||||
t1.title, t1.name, t1.page_name, t1.published_on as creation,
|
||||
ifnull(t1.blog_intro, t1.content) as content,
|
||||
t2.full_name, t2.avatar, t1.blogger,
|
||||
(select count(name) from `tabComment` where
|
||||
comment_doctype='Blog' and comment_docname=t1.name) as comments
|
||||
from `tabBlog` t1, `tabBlogger` t2
|
||||
comment_doctype='Blog Post' and comment_docname=t1.name) as comments
|
||||
from `tabBlog Post` t1, `tabBlogger` t2
|
||||
where ifnull(t1.published,0)=1
|
||||
and t1.blogger = t2.name
|
||||
%(condition)s
|
||||
order by creation desc, name asc
|
||||
limit %(start)s, 5""" % {"start": start, "condition": condition}
|
||||
order by published_on desc, name asc
|
||||
limit %(start)s, 20""" % {"start": start, "condition": condition}
|
||||
|
||||
result = webnotes.conn.sql(query, as_dict=1)
|
||||
|
||||
@ -79,7 +86,7 @@ def add_comment(args=None):
|
||||
comment_doctype='Blog' and comment_docname=%s and
|
||||
ifnull(unsubscribed, 0)=0""", args.get('comment_docname'))]
|
||||
|
||||
blog = webnotes.conn.sql("""select * from tabBlog where name=%s""",
|
||||
blog = webnotes.conn.sql("""select * from `tabBlog Post` where name=%s""",
|
||||
args.get('comment_docname'), as_dict=1)[0]
|
||||
|
||||
from webnotes.utils.email_lib.bulk import send
|
||||
@ -125,7 +132,8 @@ def get_blog_template_args():
|
||||
}
|
||||
|
||||
def get_writers_args():
|
||||
bloggers = webnotes.conn.sql("select * from `tabBlogger` order by full_name", as_dict=1)
|
||||
bloggers = webnotes.conn.sql("""select * from `tabBlogger`
|
||||
order by posts desc""", as_dict=1)
|
||||
for blogger in bloggers:
|
||||
if blogger.avatar and not "/" in blogger.avatar:
|
||||
blogger.avatar = "files/" + blogger.avatar
|
||||
|
@ -57,7 +57,7 @@ def generate():
|
||||
|
||||
items = ''
|
||||
blog_list = webnotes.conn.sql("""\
|
||||
select page_name as name, modified, creation, title from tabBlog
|
||||
select page_name as name, modified, creation, title from `tabBlog Post`
|
||||
where ifnull(published,0)=1
|
||||
order by creation desc, modified desc, name asc limit 100""", as_dict=1)
|
||||
|
||||
|
@ -23,9 +23,9 @@ wn.module_page["Website"] = [
|
||||
icon: "icon-edit",
|
||||
items: [
|
||||
{
|
||||
label: wn._("Blog"),
|
||||
description: wn._("Blog post."),
|
||||
doctype:"Blog"
|
||||
label: wn._("Blog Post"),
|
||||
description: wn._("Single Post (article)."),
|
||||
doctype:"Blog Post"
|
||||
},
|
||||
{
|
||||
label: wn._("Blogger"),
|
||||
@ -35,7 +35,7 @@ wn.module_page["Website"] = [
|
||||
{
|
||||
label: wn._("Blog Category"),
|
||||
description: wn._("Categorize blog posts."),
|
||||
doctype:"Blogger"
|
||||
doctype:"Blog Category"
|
||||
},
|
||||
]
|
||||
},
|
||||
@ -62,6 +62,7 @@ wn.module_page["Website"] = [
|
||||
{
|
||||
title: wn._("Special Page Settings"),
|
||||
icon: "icon-wrench",
|
||||
right: true,
|
||||
items: [
|
||||
{
|
||||
"route":"Form/Product Settings",
|
||||
|
@ -25,7 +25,7 @@ page_map = {
|
||||
"template": 'html/web_page.html',
|
||||
"condition_field": "published"
|
||||
}),
|
||||
'Blog': webnotes._dict({
|
||||
'Blog Post': webnotes._dict({
|
||||
"template": 'html/blog_page.html',
|
||||
"condition_field": "published",
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user