forked from jayallen/melody
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PATCH 14/24] Major UI refactor of the blog settings screen. All conf…
…ig options have been moved to a single HTML page and javascript is being used to page between them. The sidebar nav had to be updated (I also changed some of the language associated with blog preferences in the process) and of course a new file has been added: cfg_blog_settings. The remaining cfg_*.tmpl files should be slated for removal as technically, they are now obsolete. They were not removed only to facilitate roll back. Signed-off-by: Open Melody Software Group <admin@openmelody.org>
- Loading branch information
1 parent
40c40b9
commit 638729a
Showing
2 changed files
with
224 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
<$mt:setvar name="page_title" value="<__trans phrase="Blog Settings">"$> | ||
<$mt:setvar name="position_actions_bottom" value="1"$> | ||
<$mt:setvar name="general-settings" value="1"$> | ||
<mt:setvarblock name="system_msg"> | ||
<mt:if name="error"> | ||
<mtapp:statusmsg | ||
id="generic-error" | ||
class="error"> | ||
<mt:var name="error"> | ||
</mtapp:statusmsg> | ||
</mt:if> | ||
<mt:if name="saved"> | ||
<mtapp:statusmsg | ||
id="saved" | ||
class="success" | ||
rebuild="all"> | ||
<__trans phrase="Your preferences have been saved."> | ||
</mtapp:statusmsg> | ||
</mt:if> | ||
</mt:setvarblock> | ||
<mt:setvarblock name="content_nav"> | ||
<mt:include name="include/cfg_content_nav.tmpl"> | ||
</mt:setvarblock> | ||
|
||
<mt:setvarblock name="html_head" append="1"> | ||
<script type="text/javascript" src="<mt:var name="static_uri">js/tc/client.js"></script> | ||
<script type="text/javascript"> | ||
/* <![CDATA[ */ | ||
function validate (f) { | ||
if (!f.site_path.value) { | ||
alert('<__trans phrase="You must set your Local Site Path." escape="singlequotes">'); | ||
return false; | ||
} else if (!is_valid_url(f.site_url.value)){ | ||
alert('<__trans phrase="You must set a valid Site URL." escape="singlequotes">'); | ||
return false; | ||
} else if (!is_valid_path(f.site_path.value)){ | ||
alert('<__trans phrase="You must set a valid Local Site Path." escape="singlequotes">'); | ||
return false; | ||
} | ||
if (f.enable_archive_paths.checked) { | ||
if (!f.archive_path.value) { | ||
alert('<__trans phrase="You must set Local Archive Path." escape="singlequotes">'); | ||
return false; | ||
} else if (!is_valid_url(f.archive_url.value)){ | ||
alert('<__trans phrase="You must set a valid Archive URL." escape="singlequotes">'); | ||
return false; | ||
} else if (!is_valid_path(f.archive_path.value)){ | ||
alert('<__trans phrase="You must set a valid Local Archive Path." escape="singlequotes">'); | ||
return false; | ||
} | ||
} | ||
if (!f.name.value) { | ||
alert('<__trans phrase="You must set your Blog Name." escape="singlequotes">'); | ||
return false; | ||
} else if (f.server_offset.value == '') { | ||
alert('<__trans phrase="You did not select a timezone." escape="singlequotes">'); | ||
return false; | ||
} | ||
f.site_url.disabled = false; | ||
f.site_path.disabled = false; | ||
f.archive_path.disabled = false; | ||
f.archive_url.disabled = false; | ||
return true; | ||
} | ||
function is_valid_url(url_){ | ||
return url_.match( /^https?:\/\/[A-Za-z0-9!$%()=_.:,;@~-]+/ ); | ||
} | ||
function is_valid_path(path_){ | ||
var str = path_.replace(/[ "%<>\[\\\]\^`{\|}~]/g, ""); | ||
str = encodeURI(str); | ||
if (str.indexOf('%') != -1) { | ||
return false; | ||
} | ||
if (str.match(/\.\./)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
function doRemoveLicense () { | ||
document.cfg_form.cc_license.value = ''; | ||
var e = getByID('has-license'); | ||
if (e) e.style.display = 'none'; | ||
e = getByID('no-license'); | ||
if (e) e.style.display = 'block'; | ||
} | ||
|
||
function setLicense() { | ||
var w = window.open('http://creativecommons.org/license/?partner=SixApart&jurisdiction_choose=1&exit_url=<mt:var name="script_full_url">?__mode=cc_return%26license_code=[license_code]%26license_url=[license_url]%26license_button=[license_button]', 'cc', 'width=600,height=650,scrollbars=yes,resizable=no'); | ||
if ( w ) w.focus(); | ||
return false; | ||
} | ||
|
||
function disableFields(path1,path2) { | ||
var url_is = "<mt:var name="site_url" encode_js="1">"; | ||
var path_is = "<mt:var name="site_path" encode_js="1">"; | ||
if (url_is.match(/BLOG-NAME/)) { | ||
var daURL = getByID(path1); | ||
var lock = path1 +"-lock"; | ||
var lock_img = getByID(lock); | ||
daURL.disabled = false; | ||
lock_img.style.display = 'none'; | ||
} | ||
if (path_is.match(/BLOG-NAME/)) { | ||
var daPath = getByID(path2); | ||
var lock = path2 +"-lock"; | ||
var lock_img = getByID(lock); | ||
daPath.disabled = false; | ||
lock_img.style.display = 'none'; | ||
} | ||
return; | ||
} | ||
|
||
function toggleFile(path) { | ||
var fld = getByID(path); | ||
if (fld) { | ||
fld.disabled = false; | ||
fld.focus(); | ||
var which_warning = path + "-warning"; | ||
var urlwarn = getByID(which_warning); | ||
if (urlwarn) urlwarn.style.display = "block"; | ||
} | ||
var which_lock = path + "-lock"; | ||
var img = getByID(which_lock); | ||
if (img) | ||
img.style.display = 'none'; | ||
return false; | ||
} | ||
|
||
function init() { | ||
// conditionally disables | ||
disableFields('site_url','site_path'); | ||
} | ||
|
||
TC.attachLoadEvent( init ); | ||
/* ]]> */ | ||
</script> | ||
</mt:setvarblock> | ||
|
||
<mt:include name="include/header.tmpl"> | ||
|
||
<form name="cfg_form" method="post" action="<mt:var name="script_url">" onsubmit="return validate(this)"> | ||
<input type="hidden" name="id" value="<mt:var name="id" escape="html">" /> | ||
<input type="hidden" name="__mode" value="save" /> | ||
<input type="hidden" name="_type" value="blog" /> | ||
<input type="hidden" name="cfg_screen" value="cfg_prefs" /> | ||
<input type="hidden" name="blog_id" value="<mt:var name="blog_id">" /> | ||
<input type="hidden" name="return_args" value="<mt:var name="return_args" escape="html">" /> | ||
<input type="hidden" name="magic_token" value="<mt:var name="magic_token">" /> | ||
|
||
<div id="general" class="blog-preferences"> | ||
<$mt:include name="prefs/general.tmpl"$> | ||
</div> | ||
<div id="publishing" class="blog-preferences"> | ||
<$mt:include name="prefs/publishing.tmpl"$> | ||
</div> | ||
<div id="entry" class="blog-preferences"> | ||
<$mt:include name="prefs/entry.tmpl"$> | ||
</div> | ||
<div id="comments" class="blog-preferences"> | ||
<$mt:include name="prefs/comments.tmpl"$> | ||
</div> | ||
<div id="trackbacks" class="blog-preferences"> | ||
<$mt:include name="prefs/trackbacks.tmpl"$> | ||
</div> | ||
<div id="registration" class="blog-preferences"> | ||
<$mt:include name="prefs/registration.tmpl"$> | ||
</div> | ||
<div id="spam" class="blog-preferences"> | ||
<$mt:include name="prefs/spam.tmpl"$> | ||
</div> | ||
<div id="web-services" class="blog-preferences"> | ||
<$mt:include name="prefs/web_services.tmpl"$> | ||
</div> | ||
<mt:if name="show_ip_info"> | ||
<div id="ip-banning" class="blog-preferences"> | ||
<$mt:include name="prefs/ip-banning.tmpl"$> | ||
</div> | ||
</mt:if> | ||
|
||
<mt:setvarblock name="action_buttons"> | ||
<button | ||
type="submit" | ||
accesskey="s" | ||
title="<__trans phrase="Save changes to these settings (s)">" | ||
class="primary-button" | ||
><__trans phrase="Save Changes"></button> | ||
</mt:setvarblock> | ||
<mt:include name="include/actions_bar.tmpl" bar_position="bottom" hide_pager="1" settings_bar="1"> | ||
|
||
</form> | ||
|
||
<mt:include name="include/footer.tmpl"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters