Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed Registration bug, updates js and css, added new translations.

  • Loading branch information...
commit 688c345ddb00cb00b0b174cefa7ce3805ef108d0 1 parent f60b564
Dmitri snytkine authored
Showing with 900 additions and 242 deletions.
  1. +1 −0  acl.ini
  2. +2 −1  acl.ini.dist
  3. +19 −5 lib/Lampcms/Cache.php
  4. +1 −7 lib/Lampcms/Controllers/Ask.php
  5. +4 −9 lib/Lampcms/Controllers/Askform.php
  6. +2 −2 lib/Lampcms/Controllers/Changepwd.php
  7. +79 −0 lib/Lampcms/Controllers/Clearcache.php
  8. +1 −1  lib/Lampcms/Controllers/Editprofile.php
  9. +1 −1  lib/Lampcms/Controllers/Emailoptions.php
  10. +15 −16 lib/Lampcms/Controllers/Register.php
  11. +21 −5 lib/Lampcms/Controllers/Settings.php
  12. +42 −43 lib/Lampcms/Controllers/Viewquestions.php
  13. +4 −4 lib/Lampcms/Forms/Answerform.php
  14. +12 −5 lib/Lampcms/Forms/Askform.php
  15. +23 −6 lib/Lampcms/Forms/Changepwd.php
  16. +4 −0 lib/Lampcms/Forms/EmailOptions.php
  17. +32 −5 lib/Lampcms/Forms/Form.php
  18. +3 −0  lib/Lampcms/Forms/Profile.php
  19. +6 −8 lib/Lampcms/I18n/Translator.php
  20. +7 −10 lib/Lampcms/Locale/Locale.php
  21. +2 −5 lib/Lampcms/MongoCache.php
  22. +1 −1  lib/Lampcms/Object.php
  23. +7 −10 lib/Lampcms/Registry.php
  24. +15 −0 lib/Lampcms/Template/Urhere.php
  25. +11 −0 lib/Lampcms/User.php
  26. +7 −4 lib/Lampcms/Validate.php
  27. +18 −2 lib/Lampcms/WebPage.php
  28. +153 −1 translations/messages.ru.xlf
  29. +275 −0 www/js/min/qa_08102011.js
  30. +18 −2 www/js/qa.js
  31. +78 −58 www/style/1/www/_main.css
  32. +11 −11 www/style/1/www/main.css
  33. +1 −1  www/style/1/www/tplFormEmailOptions.php
  34. +3 −2 www/style/1/www/tplFormanswer.php
  35. +4 −3 www/style/1/www/tplFormask.php
  36. +7 −5 www/style/1/www/tplFormchangepwd.php
  37. +1 −1  www/style/1/www/tplMain.php
  38. +4 −3 www/style/1/www/tplQrecent.php
  39. +2 −2 www/style/1/www/tplQuntypes.php
  40. +3 −3 www/style/1/www/tplSettings.php
1  acl.ini
View
@@ -102,6 +102,7 @@ shred_user = A
change_user_role = A
make_sticky = A
edit_any_profile = A
+clear_cache = A
;
;user caught spamming
3  acl.ini.dist
View
@@ -102,7 +102,8 @@ shred_user = A
change_user_role = A
make_sticky = A
edit_any_profile = A
-
+clear_cache = A
+
;
;user caught spamming
[spammer]
24 lib/Lampcms/Cache.php
View
@@ -245,6 +245,20 @@ public function setCacheEngine(Interfaces\Cache $oCache = null){
}
+ /**
+ * Remove all data from cache
+ *
+ * @return object $this
+ */
+ public function flush(){
+ if(!$this->skipCache){
+ $this->oCacheInterface->flush();
+ }
+
+ return $this;
+ }
+
+
protected function getMissingKeys(){
d('Could not get all keys from cache'.print_r($this->aMissingKeys, 1));
$arrFoundKey = array();
@@ -648,7 +662,7 @@ protected function Acl(){
return new \Lampcms\Acl\Acl();
}
-
+
/**
* @param string $locale name of locate for this object
* (for example 'en_CA' for Canada)
@@ -663,7 +677,7 @@ protected function xliff($key){
return new \Lampcms\I18n\XliffCatalog($file, $key);
}
-
+
/**
*
@@ -675,10 +689,10 @@ protected function tr($locale){
d('$locale: '.$locale);
$this->aTags = array('tr');
- $o = \Lampcms\I18n\Translator::factory($this->oRegistry, $locale);
-
+ $o = \Lampcms\I18n\Translator::factory($this, $locale);
+
d('returning o: '.get_class($o));
-
+
return $o;
}
8 lib/Lampcms/Controllers/Ask.php
View
@@ -69,7 +69,7 @@ class Ask extends Askform
protected function main(){
- $this->aPageVars['title'] = "Ask a Question";
+ $this->aPageVars['title'] = $this->_('Ask a question');
$a = $this->oRegistry->Request->getArray();
d('request: '.print_r($a, 1).' POST: '.print_r($_POST, 1));
@@ -104,14 +104,8 @@ protected function process(){
$oQuestion = $oAdapter->parse(new SubmittedQuestionWWW($this->oRegistry, $formVals));
d('cp created new question');
d('title: '.$oQuestion['title']);
-
- /*if(LAMPCMS_DEBUG){
- Responder::sendJSON(array());
- }*/
Responder::redirectToPage($oQuestion->getUrl());
-
-
} catch (QuestionParserException $e){
$this->oForm->setFormError($e->getMessage());
$this->showFormWithErrors();
13 lib/Lampcms/Controllers/Askform.php
View
@@ -97,7 +97,7 @@ class Askform extends WebPage
* @see WebPage::main()
*/
protected function main(){
- $this->aPageVars['title'] = $this->title = 'Ask a question';
+ $this->aPageVars['title'] = $this->title = $this->_('Ask a question');
$this->addMetas()
->configureEditor()
@@ -176,7 +176,7 @@ protected function makeTopTabs(){
* @return object $this
*/
protected function makeMemo(){
- $memo = '<strong>Ask question relevant to this community</strong>
+ $memo = '<strong>'.$this->_('Ask question relevant to this community').'</strong>
<ul>
<li>Provide enough details</li>
<li>Be clear and concise</li>
@@ -201,17 +201,12 @@ protected function makeHintBlocks(){
* which in turn will trigger popup on click
* on the form element
*
- * @todo move this into Form? Yes, but allow passing
- * custom message for qbody
- *
- * @todo translate qbody
- *
* @return object $this
*/
protected function setMustLogin(){
if(!$this->isLoggedIn()){
- $this->oForm->qbody = 'Please login to post your question';
+ $this->oForm->qbody = $this->_('Please login to post your question');
$this->oForm->com_hand = ' com_hand';
$this->oForm->readonly = 'readonly="readonly"';
$this->oForm->disabled = ' disabled="disabled"';
@@ -223,7 +218,7 @@ protected function setMustLogin(){
* @todo Translate string
*/
if(!empty($socialButtons)){
- $this->oForm->connectBlock = '<div class="com_connect"><h3>Join with account you already have</h3>'.$socialButtons.'</div>';
+ $this->oForm->connectBlock = '<div class="com_connect"><h3>'.$this->_('Join with account you already have').'</h3>'.$socialButtons.'</div>';
}
}
4 lib/Lampcms/Controllers/Changepwd.php
View
@@ -81,7 +81,7 @@ class Changepwd extends Resetpwd
protected function main(){
$this->oForm = new \Lampcms\Forms\Changepwd($this->oRegistry);
- $this->oForm->formTitle = $this->aPageVars['title'] = 'Change password';
+ $this->oForm->formTitle = $this->aPageVars['title'] = $this->_('Change Password');
if($this->oForm->isSubmitted() && $this->oForm->validate()){
$this->saveNewPassword();
@@ -89,7 +89,7 @@ protected function main(){
$this->emailPwd();
}
- $this->aPageVars['body'] = '<div id="tools">'.self::TPL_SUCCESS.'</div>';
+ $this->aPageVars['body'] = '<div id="tools">'.$this->_('Password updated successfully').'</div>';
} else {
$this->aPageVars['body'] = $this->oForm->getForm();
79 lib/Lampcms/Controllers/Clearcache.php
View
@@ -0,0 +1,79 @@
+<?php
+/**
+ *
+ * License, TERMS and CONDITIONS
+ *
+ * This software is lisensed under the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) version 3
+ * Please read the license here : http://www.gnu.org/licenses/lgpl-3.0.txt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * ATTRIBUTION REQUIRED
+ * 4. All web pages generated by the use of this software, or at least
+ * the page that lists the recent questions (usually home page) must include
+ * a link to the http://www.lampcms.com and text of the link must indicate that
+ * the website\'s Questions/Answers functionality is powered by lampcms.com
+ * An example of acceptable link would be "Powered by <a href="http://www.lampcms.com">LampCMS</a>"
+ * The location of the link is not important, it can be in the footer of the page
+ * but it must not be hidden by style attibutes
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This product includes GeoLite data created by MaxMind,
+ * available from http://www.maxmind.com/
+ *
+ *
+ * @author Dmitri Snytkine <cms@lampcms.com>
+ * @copyright 2005-2011 (or current year) ExamNotes.net inc.
+ * @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE (LGPL) version 3
+ * @link http://www.lampcms.com Lampcms.com project
+ * @version Release: @package_version@
+ *
+ *
+ */
+
+
+namespace Lampcms\Controllers;
+
+use Lampcms\WebPage;
+
+/**
+ * Controller for clearing
+ * cache.
+ *
+ * @author admin
+ *
+ */
+class Clearcache extends WebPage
+{
+
+ protected $permission = 'clear_cache';
+
+ protected $membersOnly = true;
+
+ protected $layoutID = 1;
+
+ protected function main(){
+ $this->oRegistry->Cache->flush();
+
+ $this->aPageVars['body'] = '<div id="tools">'.$this->_('Cache Cleared').'</div>';
+
+ }
+}
2  lib/Lampcms/Controllers/Editprofile.php
View
@@ -104,7 +104,7 @@ class Editprofile extends WebPage
protected function main(){
$this->getUser();
$this->oForm = new \Lampcms\Forms\Profile($this->oRegistry);
- $this->oForm->formTitle = $this->aPageVars['title'] = 'Edit profile';
+ $this->oForm->formTitle = $this->aPageVars['title'] = $this->_('Edit Profile');
if($this->oForm->isSubmitted() && $this->oForm->validate()){
$this->oRegistry->Dispatcher->post($this->oForm, 'onBeforeProfileUpdate');
2  lib/Lampcms/Controllers/Emailoptions.php
View
@@ -92,7 +92,7 @@ protected function main(){
$email = $this->oRegistry->Viewer->email;
$this->oForm = new \Lampcms\Forms\EmailOptions($this->oRegistry);
- $this->oForm->formTitle = $this->aPageVars['title'] = 'Your Email Subscription Preferences';
+ $this->oForm->formTitle = $this->aPageVars['title'] = $this->_('Your Email Subscription Preferences');
$this->oForm->your_email = $email;
if($this->oForm->isSubmitted()){
31 lib/Lampcms/Controllers/Register.php
View
@@ -146,7 +146,7 @@ class Register extends WebPage
protected $oEmail;
protected function main(){
- $this->aPageVars['title'] = 'Create new account';
+ $this->aPageVars['title'] = $this->_('Create New Account');
/**
* Don't bother with token
* for this form.
@@ -170,10 +170,10 @@ protected function main(){
*/
$this->oForm->setVar('divID', 'registration');
$this->oForm->setVar('className', 'registration');
- $this->oForm->setVar('header2', 'Join us!');
- $this->oForm->setVar('button', '<input name="submit" value="Register!" type="submit" class="btn btn-m">');
+ $this->oForm->setVar('header2', $this->_('Create New Account'));
+ $this->oForm->setVar('button', '<input name="submit" value="'.$this->_('Register').'" type="submit" class="btn btn-m">');
$this->oForm->setVar('captcha', Captcha::factory($this->oRegistry)->getCaptchaBlock());
- $this->oForm->setVar('title', 'Create an Account');
+ $this->oForm->setVar('title', $this->_('Create an Account'));
$this->oForm->setVar('titleBar', '');
if($this->oForm->isSubmitted() && $this->oForm->validate()){
@@ -234,19 +234,18 @@ protected function createNewUser(){
$sid = \Lampcms\Cookie::getSidCookie();
- $aData['username'] = $this->username;
- $aData['username_lc'] = strtolower($this->username);
- $aData['email'] = $this->email;
- $aData['rs'] = (false !== $sid) ? $sid : \Lampcms\String::makeSid();
- $aData['role'] = $this->getRole();
- $aData['tz'] = \Lampcms\TimeZone::getTZbyoffset($this->oRequest->get('tzo'));
-
+ $aData['username'] = $this->username;
+ $aData['username_lc'] = strtolower($this->username);
+ $aData['email'] = $this->email;
+ $aData['rs'] = (false !== $sid) ? $sid : \Lampcms\String::makeSid();
+ $aData['role'] = $this->getRole();
+ $aData['tz'] = \Lampcms\TimeZone::getTZbyoffset($this->oRequest->get('tzo'));
$aData['pwd'] = String::hashPassword($this->pwd);
- $aData['i_reg_ts'] = time();
- $aData['date_reg'] = date('r');
- $aData['i_fv'] = (false !== $intFv = \Lampcms\Cookie::getSidCookie(true)) ? $intFv : time();
- $aData['lang'] = $this->oRegistry->getCurrentLang();
- $aData['locale'] = $this->oRegistry->getLocale();
+ $aData['i_reg_ts'] = time();
+ $aData['date_reg'] = date('r');
+ $aData['i_fv'] = (false !== $intFv = \Lampcms\Cookie::getSidCookie(true)) ? $intFv : time();
+ $aData['lang'] = $this->oRegistry->getCurrentLang();
+ $aData['locale'] = $this->oRegistry->Locale->getLocale();
/**
* Initial reputation is always 1
* @var int
26 lib/Lampcms/Controllers/Settings.php
View
@@ -63,7 +63,7 @@ class Settings extends WebPage
{
protected $membersOnly = true;
-
+
protected $layoutID = 1;
protected function main(){
@@ -74,18 +74,34 @@ protected function main(){
* different browser
*/
$this->oRegistry->Viewer->reload();
+
+ $this->aPageVars['title'] = $this->_('Edit settings');
- $this->aPageVars['title'] = 'Edit settings';
$vals = array(
+
'confirmation' => $this->makeConfirmBlock(),
- 'change_password' => 'Change Password',
- 'profile' => 'Edit Profile',
+ 'change_password' => $this->_('Change Password'),
+ 'profile' => $this->_('Edit Profile'),
'profileUrl' => '/editprofile/',
- 'emailPrefs' => 'Email Preferences'
+ 'emailPrefs' => $this->_('Email Preferences'),
+ 'clearCache' => ''
);
+
+ if($this->oRegistry->Viewer->isAdmin()){
+ $vals['clearCache'] = $this->makeClearCache();
+ }
+
$this->aPageVars['body'] = \tplSettings::parse($vals);
}
+
+
+ protected function makeClearCache(){
+ return '<div class="tool">
+ <div class="icn sweep">&nbsp;</div>
+ <div class="tool_link"><a href="/clearcache/" class="ajax clearcache">'.$this->_('Clear Cache').'</a></div>
+ </div>';
+ }
protected function makeConfirmBlock(){
85 lib/Lampcms/Controllers/Viewquestions.php
View
@@ -106,11 +106,11 @@ class Viewquestions extends WebPage
protected $PER_PAGE = 20;
protected $counterTaggedText = '';
-
+
/**
* Exclude these fields from
* select for effeciency
- *
+ *
* @var array
*/
protected $aFields = array(
@@ -118,7 +118,7 @@ class Viewquestions extends WebPage
'a_flwrs' => 0,
'sim_q' => 0,
'a_comments' => 0
- );
+ );
/**
* Pagination links on the page
@@ -156,7 +156,7 @@ protected function getCursor(){
$this->PER_PAGE = $this->oRegistry->Ini->PER_PAGE_QUESTIONS;
//$aFields = array();
-
+
$cond = $this->oRequest->get('cond', 's', 'recent');
d('cond: '.$cond);
@@ -189,7 +189,7 @@ protected function getCursor(){
* uncache onQuestionVote, onQuestionComment
*/
case 'active':
- $this->title = 'Active Questions';
+ $this->title = $this->_('Active Questions');
$this->pagerPath = '/active';
$this->typeDiv = Urhere::factory($this->oRegistry)->get('tplQtypesdiv', 'active');
$where = array('i_ts' => array('$gt' => (time() - 604800)));
@@ -206,7 +206,7 @@ protected function getCursor(){
case 'voted':
$this->pagerPath = '/voted';
d('cp');
- $this->title = 'Questions with highest votes in past 7 days';
+ $this->title = $this->_('Questions with highest votes in past 7 days');
$this->typeDiv = Urhere::factory($this->oRegistry)->get('tplQtypesdiv', 'voted');
$where = array('i_ts' => array('$gt' => (time() - 604800)));
$sort = array('i_votes' => -1);
@@ -288,7 +288,7 @@ protected function makeRecentTags(){
} else {
$s = $this->oRegistry->Cache->get('qrecent');
}
-
+
$tags = \tplBoxrecent::parse(array('tags' => $s, 'title' => $this->_('Recent Tags')));
d('cp');
$this->aPageVars['tags'] = $tags;
@@ -313,7 +313,7 @@ protected function sendCacheHeaders(){
protected function makeTopTabs(){
-
+
$tabs = Urhere::factory($this->oRegistry)->get('tplToptabs', $this->qtab);
$this->aPageVars['topTabs'] = $tabs;
@@ -322,7 +322,7 @@ protected function makeTopTabs(){
protected function makeQlistHeader(){
-
+
$this->aPageVars['qheader'] = '<h1>'.$this->title.'</h1>';
return $this;
@@ -330,40 +330,40 @@ protected function makeQlistHeader(){
protected function makeQlistBody(){
-
+
$uid = $this->oRegistry->Viewer->getUid();
- d(' uid of viewer: '.$uid);
- $func = null;
- if($uid > 0){
- $aUserTags = $this->oRegistry->Viewer['a_f_t'];
- $showDeleted = $this->oRegistry->Viewer->isModerator();
+ $aUserTags = $this->oRegistry->Viewer['a_f_t'];
+ $showDeleted = $this->oRegistry->Viewer->isModerator();
+ $contributed = $this->_('You have contributed to this question');
+ $following = $this->_('You are following this question');
+ $asked = $this->_('Asked');
+ $latestBy = $this->_('Latest answer by');
+ $toggle = $this->_('Toggle Unread/Read Status');
+
+ $func = function(&$a) use($uid, $aUserTags, $showDeleted, $following, $contributed, $asked, $latestBy, $toggle){
- $func = function(&$a) use($uid, $aUserTags, $showDeleted){
+ if($uid == $a['i_uid'] || (!empty($a['a_uids']) && in_array($uid, $a['a_uids'])) ){
+ $a['dot'] = '<div class="fr pad2"><span class="ico person ttt" title="'.$contributed.'">&nbsp;</span></div>';
+ }
- /**
- * @todo translate string
- */
- if($uid == $a['i_uid'] || (!empty($a['a_uids']) && in_array($uid, $a['a_uids'])) ){
- $a['dot'] = '<div class="fr pad2"><span class="ico person ttt" title="You have contributed to this question">&nbsp;</span></div>';
- }
+ if(!empty($a['a_flwrs']) && in_array($uid, $a['a_flwrs']) ){
+ $a['following_q'] = '<div class="fr pad2"><span class="icoc check ttt" title="'.$following.'">&nbsp;</span></div>';
+ }
- /**
- * @todo translate string
- */
- if(!empty($a['a_flwrs']) && in_array($uid, $a['a_flwrs']) ){
- $a['following_q'] = '<div class="fr pad2"><span class="icoc check ttt" title="You are following this question">&nbsp;</span></div>';
- }
+ /**
+ * Add special flag if user following
+ * at least one of the tag of this question.
+ */
+ if(count(array_intersect($a['a_tags'], $aUserTags)) > 0){
+ $a['following_tag'] = ' followed_tag';
+ }
+
+ $a['asked'] = $asked;
+ $a['toggle'] = $toggle;
+ $a['latest_by'] = $latestBy;
+ };
- /**
- * Add special flag if user following
- * at least one of the tag of this question.
- */
- if(count(array_intersect($a['a_tags'], $aUserTags)) > 0){
- $a['following_tag'] = ' followed_tag';
- }
- };
- }
$sQdivs = \tplQrecent::loop($this->oCursor, true, $func);
@@ -378,12 +378,11 @@ protected function makeQlistBody(){
/**
- * @todo
- * Translate string
+ *
*
*/
protected function makeCounterBlock(){
- $this->aPageVars['topRight'] = \tplCounterblock::parse(array($this->oCursor->count(), 'Questions and counting', ''), false);
+ $this->aPageVars['topRight'] = \tplCounterblock::parse(array($this->oCursor->count(), $this->_('Number of Questions'), ''), false);
return $this;
}
@@ -398,8 +397,6 @@ protected function makeCounterBlock(){
* This block is only added if user follows
* at least one tag
*
- * @todo Translate string Tags you follow
- *
* @return object $this
*/
protected function makeFollowedTags(){
@@ -408,7 +405,9 @@ protected function makeFollowedTags(){
d('$aFollowed: '.print_r($aFollowed, 1));
if(!empty($aFollowed)){
- $this->aPageVars['side'] = '<div id="usrtags" class="fl cb w90 pl10 mb10"><div class="pad8 lg cb fr rounded3 w90"><h4>Tags you follow</h4>'.\tplFollowedTags::loop($aFollowed, false).'</div></div>';
+ $this->aPageVars['side'] = '<div id="usrtags" class="fl cb w90 pl10 mb10"><div class="pad8 lg cb fr rounded3 w90"><h4>'.
+ $this->_('Tags you follow').'</h4>'.
+ \tplFollowedTags::loop($aFollowed, false).'</div></div>';
}
8 lib/Lampcms/Forms/Answerform.php
View
@@ -89,7 +89,6 @@ public function getAnswerForm(\Lampcms\Question $oQuestion){
d('cp');
- $Tr = $this->oRegistry->Tr;
/**
* A custom observer may cancel the onBeforeAnswerform event
@@ -121,15 +120,16 @@ public function getAnswerForm(\Lampcms\Question $oQuestion){
d('cp');
- $formTitle = (0 === $oQuestion['i_ans']) ? $Tr['Be the first to answer this question'] : $Tr['Your answer'] ;
+ $formTitle = (0 === $oQuestion['i_ans']) ? $this->Tr['Be the first to answer this question'] : $this->Tr['Your answer'] ;
$this->setVar('title', $formTitle);
$this->setVar('qid', $oQuestion['_id']);
- $this->setVar('submit', $Tr['Submit answer']);
+ $this->setVar('submit', $this->Tr['Submit answer']);
+ $this->setVar('preview', $this->Tr['Preview']);
if($this->oRegistry->Viewer->isGuest()){
d('cp');
- $this->qbody = 'Please login to post your answer';
+ $this->qbody = $this->_('Please login to post your answer');
$this->com_hand = ' com_hand';
$this->readonly = 'readonly="readonly"';
$this->disabled = ' disabled="disabled"';
17 lib/Lampcms/Forms/Askform.php
View
@@ -77,6 +77,7 @@ class Askform extends Form
protected function init(){
+
/**
* This is just an example how a custom validation
* callback could be added to form
@@ -98,8 +99,15 @@ protected function init(){
$minTags = $this->oRegistry->Ini->MIN_QUESTION_TAGS;
$maxTags = $this->oRegistry->Ini->MAX_QUESTION_TAGS;
- $d = 'Please enter between %s and %s tags, separated by spaces';
- $this->setVar('tags_d', sprintf($d, $minTags, $maxTags));
+ $d = $this->Tr->get('Please enter between {min_tags} and {max_tags} tags, separated by spaces', array('{min_tags}' => $minTags, '{max_tags}' => $maxTags));
+ $this->setVar('tags_d', $d);
+ $this->setVar('tags_l', $this->Tr['Tags']);
+ $this->setVar('Preview', $this->Tr['Preview']);
+ $this->setVar('Preview', $this->Tr['Preview']);
+ $this->setVar('title_d', $this->Tr['Enter a descriptive title']);
+ $this->setVar('title_l', $this->Tr['Title']);
+ $this->setVar('submit', $this->Tr['Ask Question']);
+
if($minTags > 0){
$tagsRequired = '(* %s)';
$this->setVar('tags_required', sprintf($tagsRequired, 'required'));
@@ -121,7 +129,6 @@ protected function init(){
protected function doValidate(){
$this->validateBody()->validateTitle()->validateTags();
-
}
@@ -187,9 +194,9 @@ protected function validateTags(){
$max = $this->oRegistry->Ini->MAX_QUESTION_TAGS;
$tags = $this->oRegistry->Request->get('tags', 's', '');
$tags = \trim($tags);
- if(($min > 0) && empty($tags)){
+ /*if(($min > 0) && empty($tags)){
$this->setError('tags', 'You must include at least one tag');
- }
+ }*/
\mb_regex_encoding('UTF-8');
$aTags = \mb_split('([\s,;]+)', $tags);
29 lib/Lampcms/Forms/Changepwd.php
View
@@ -62,7 +62,7 @@
*/
class Changepwd extends Form
{
-
+
/**
* Name of form template file
* The name of actual template should be
@@ -79,6 +79,19 @@ protected function doValidate(){
}
+ protected function init(){
+
+ $this->setVar('submit', $this->Tr['Save']);
+ $this->setVar('forgot', $this->Tr['Forgot password?']);
+
+ $this->setVar('current_l', $this->Tr['Current Password']);
+ $this->setVar('pwd1_l', $this->Tr['Enter new password']);
+ $this->setVar('pwd2_l', $this->Tr['Confirm new password']);
+ $this->setVar('current_d', $this->Tr['Enter your current password']);
+
+ }
+
+
/**
* validate current password
*
@@ -91,18 +104,22 @@ protected function validatePassword(){
$oCheckLogin = new UserAuth($this->oRegistry);
$oUser = $oCheckLogin->validateLogin($this->oRegistry->Viewer->username, $current);
} catch (\Lampcms\LoginException $e) {
- $this->setError('current', 'This is not the correct password');
+ $this->setError('current', $this->_('This is not the correct password'));
}
return $this;
}
-
+ /**
+ * Validate that password is valid
+ * according to rules set in Validate::enforcePwd
+ *
+ * @return $this
+ */
protected function validateNewPassword(){
$pwd1 = $this->getSubmittedValue('pwd1');
if (false === Validate::enforcePwd($pwd1)) {
- $this->setError('pwd1', 'Invalid. Password must be at least 6 characters long and contain letters and at least one number');
-
+ $this->setError('pwd1', $this->_('Password must be at least 6 characters long and contain at least one number'));
}
return $this;
@@ -120,7 +137,7 @@ protected function comparePasswords(){
$pwd2 = $this->getSubmittedValue('pwd2');
if($pwd1 !== $pwd2){
- $this->setFormError('"New password" and "Confirm new password" do not match');
+ $this->setFormError($this->_('"New password" and "Confirm new password" do not match'));
}
return $this;
4 lib/Lampcms/Forms/EmailOptions.php
View
@@ -61,4 +61,8 @@ class EmailOptions extends Form
* @var string
*/
protected $template = 'tplFormEmailOptions';
+
+ protected function init(){
+ $this->setVar('save_l', $this->_('Save'));
+ }
}
37 lib/Lampcms/Forms/Form.php
View
@@ -185,9 +185,18 @@ class Form extends LampcmsObject
*/
protected $aErrors = array();
+ /**
+ * Translation object
+ *
+ * @var Object of type Lampcms\I18n\Translator
+ */
+ protected $Tr;
+
public function __construct(Registry $oRegistry, $useToken = true){
$this->oRegistry = $oRegistry;
+ $this->Tr = $oRegistry->Tr;
+
$this->useToken = $useToken;
$tpl = $this->template;
d('tpl: '.$tpl);
@@ -211,6 +220,24 @@ public function __construct(Registry $oRegistry, $useToken = true){
/**
+ * Translator method
+ * It's customary in many projects to
+ * use the single underscore
+ * symbol for translation function.
+ *
+ * @param string $string string to translate
+ * @param array $vars optional array of replacement vars for
+ * translation
+ *
+ * @return string translated string
+ */
+ protected function _($string, array $vars = null){
+
+ return $this->Tr->get($string, $vars);
+ }
+
+
+ /**
* Check to see if form has been submitted
*
* @return bool true if form submitted, false
@@ -354,7 +381,7 @@ public function getUploadedFile($field){
if(!array_key_exists($field, $this->aUploads)){
d('no such file in uploads: '.$field);
-
+
return null;
}
@@ -561,12 +588,12 @@ public function getErrors(){
/**
* Parse form template using vars/values we set
* also if aErrors not empty, merge it with aVars
- *
+ *
* @param bool $useSubmittedVars if set to false then
* will not update $this->aVars to the values of submitted
* values and will reuse the vars that were set initially.
* This is useful when form was submitted but then some error
- * occured in a script that was parsing the form.
+ * occured in a script that was parsing the form.
* In that case
* we often need to setFormError and then use values in form
* than were there initially, no using any of the submitted values.
@@ -575,11 +602,11 @@ public function getErrors(){
*/
public function getForm($useSubmittedVars = true){
d('$this->aVars: '.print_r($this->aVars, 1));
-
+
if($useSubmittedVars){
$this->prepareVars();
}
-
+
$this->addErrors();
$tpl = $this->template;
3  lib/Lampcms/Forms/Profile.php
View
@@ -67,6 +67,9 @@ class Profile extends Form
protected $template = 'tplFormprofile';
+ protected function init(){
+ $this->setVar('submit', $this->_('Save'));
+ }
/**
* Concrete form validator for this form
* (non-PHPdoc)
14 lib/Lampcms/I18n/Translator.php
View
@@ -105,14 +105,12 @@ class Translator implements \Serializable, \ArrayAccess, \Lampcms\Interfaces\Tra
*
* @param \Lampcms\Registry $oRegistry
*/
- public static function factory(\Lampcms\Registry $oRegistry, $locale = ''){
+ public static function factory(\Lampcms\Cache $Cache, $locale){
if(!\is_string($locale)){
throw new \Lampcms\DevException('Param $locale must be a string. Was: '.gettype($locale));
}
-
- $oCache = $oRegistry->Cache;
+
$fallback = null;
- $locale = ('' !== $locale) ? $locale : $oRegistry->Locale->getLocale();
if (strlen($locale) > 3) {
d('going to also use lang fallback for $locale: '.$locale);
@@ -132,14 +130,14 @@ public static function factory(\Lampcms\Registry $oRegistry, $locale = ''){
* one for default if different
* from $locale and from $fallback
*/
- $o->addCatalog($oCache->get('xliff_'.$locale));
+ $o->addCatalog($Cache->get('xliff_'.$locale));
if(!empty($fallback) && ($fallback !== $locale) ){
- $o->addCatalog($oCache->get('xliff_'.$fallback));
+ $o->addCatalog($Cache->get('xliff_'.$fallback));
}
if(!empty($default) && ($default !== $fallback) && ($default !== $locale) ){
- $o->addCatalog($oCache->get('xliff_'.$default));
+ $o->addCatalog($Cache->get('xliff_'.$default));
}
return $o;
@@ -183,7 +181,7 @@ public function getLocale(){
public function get($string, array $vars = null, $default = null){
$str = (!empty($this->aMessages[$string])) ? $this->aMessages[$string] : (is_string($default) ? $default : $string);
- return (null === $vars) ? $str : strtr($str, $vars);
+ return (!$vars) ? $str : strtr($str, $vars);
}
17 lib/Lampcms/Locale/Locale.php
View
@@ -104,7 +104,7 @@ public function init(){
if(empty($locale)) {
$this->locale = LAMPCMS_DEFAULT_LOCALE;
}
-
+
if (isset($_SESSION)) {
$_SESSION['locale'] = $this->locale;
}
@@ -142,7 +142,9 @@ public static function factory(\Lampcms\Registry $o){
*/
public function makeOptions(){
$a = $this->Registry->Ini['LOCALES'];
- $tpl = '<option value="%s"%s>%s</option>';
+ $tplWrapper = '<div class="fr langs" id="id_langs"><div class="fl icn globe"></div>
+ %s</div>';
+ $tpl = '<option class="fl" value="%s"%s>%s</option>';
$ret = '';
/**
@@ -154,21 +156,16 @@ public function makeOptions(){
*/
if(!empty($a) && is_array($a) && count($a) > 1){
foreach($a as $locale => $name){
- $selected = ($locale === $this->locale) ? ' selected="selected"' : '';
+ $selected = ($locale === $this->locale) ? ' selected' : '';
$ret .= sprintf($tpl, $locale, $selected, $name);
}
$tpl = '<select name="locale" class="locales" id="id_locale">%s</select>';
- /*$tpl = '<form action="/index.php" id="form_locale">
- <select name="locale" class="locales" id="id_locale">%s</select>
- <input type="submit" value="submit">
- </form>';*/
-
$ret = sprintf($tpl, $ret);
}
- return $ret;
+ return sprintf($tplWrapper, $ret);
}
@@ -186,7 +183,7 @@ public function makeOptions(){
public function getOptions(){
/*if(isset($_SESSION) && !empty($_SESSION['langs'])){
return $_SESSION['langs'];
- }*/
+ }*/
$langs = $this->makeOptions();
7 lib/Lampcms/MongoCache.php
View
@@ -123,7 +123,7 @@ public static function factory(Registry $oRegistry){
* @param string $collection name of collection
*/
public function __construct(\Mongo $oMongo, $db, $collection, $nameSpace = null, $compress = false){
- d('cp');
+
if (!extension_loaded('mongo')) {
throw new \LogicException('The MongoDB extension must be loaded for using this backend !');
}
@@ -138,12 +138,9 @@ public function __construct(\Mongo $oMongo, $db, $collection, $nameSpace = null,
$this->bCompress = (bool)$compress;
}
-
- $this->oMongo = $oMongo;
- d('cp');
+ $this->oMongo = $oMongo;
$this->_collection = $oMongo->selectCollection($db, $collection);//$this->_db->selectCollection($collection);
$this->_collection->ensureIndex(array('tags' => 1));
- d('cp');
}
2  lib/Lampcms/Object.php
View
@@ -52,7 +52,7 @@
namespace Lampcms;
-const JS_MIN_ID = '06262011';
+const JS_MIN_ID = '08102011';
const LF = "\n";
const CR = "\r";
17 lib/Lampcms/Registry.php
View
@@ -156,15 +156,16 @@ protected function init(){
$this->values['Locale'] = $this->asShared(function ($c) {
-
+
return new \Lampcms\Locale\Locale($c);
});
-
-
+
+
$this->values['Tr'] = $this->asShared(function ($c) {
+
$l = $c->Locale->getLocale();
+
return $c->Cache->{'tr_'.$l};
- //return new \Lampcms\Locale\Locale($c);
});
@@ -182,11 +183,7 @@ protected function init(){
$this->values['Acl'] = $this->asShared(function ($c) {
- /*if($c->Ini->CACHE_ACL){
- return $c->Cache->Acl;
- }*/
-
- return new \Lampcms\Acl\Acl();
+ return $c->Cache->Acl;
});
/**
@@ -456,7 +453,7 @@ public function getCurrentLang(){
return $defaultLang;
}
-
+
/**
15 lib/Lampcms/Template/Urhere.php
View
@@ -155,6 +155,21 @@ protected function translate($template, array &$vars){
$vars['search_label'] = $Translator['Search'];
break;
+ case 'tplQtypesdiv':
+ $vars['newest'] = $Translator['Newest'];
+ $vars['newest_t'] = $Translator['Most recent questions'];
+ $vars['voted'] = $Translator['Most Voted'];
+ $vars['voted_t'] = $Translator['Questions with most votes'];
+ $vars['active'] = $Translator['Most Active'];
+ $vars['active_t'] = $Translator['Questions with most activity'];
+ break;
+
+ case 'tplQuntypes':
+ $vars['newest'] = $Translator['Unanswered'];
+ $vars['newest_t'] = $Translator['Questions with no accepted answer'];
+ $vars['noanswer'] = $Translator['No Answers'];
+ $vars['noanswer_t'] = $Translator['Questions with no answers'];
+ break;
}
}
11 lib/Lampcms/User.php
View
@@ -195,6 +195,17 @@ public function isModerator(){
return (('administrator' === $role) || false !== (\strstr($role, 'moderator')) );
}
+
+ /**
+ * Check if user is administrator
+ *
+ * @return bool
+ *
+ */
+ public function isAdmin(){
+
+ return ('administrator' === $this->getRoleId());
+ }
/**
11 lib/Lampcms/Validate.php
View
@@ -118,20 +118,23 @@ public static function username($string){
/**
* Verifies that password contains
- * at least one letter and at least one number
+ * least one number
* and is at least 6 chars long
+ * At this time its difficult to validate
+ * that password contains letter because not sure
+ * how to validate a letter in utf-8 string.
*
* @param string $pwd password to validate
*
* @return bool true if validation passes, false otherwise
*/
public static function enforcePwd($pwd){
- $res = preg_match('/[a-zA-Z]+/', $pwd, $matches);
+ //$res = preg_match('/[a-zA-Z]+/', $pwd, $matches);
$res2 = preg_match('/\d+/', $pwd);
- d('$res: '.$res.' $res2 '.$res2);
+ //d('$res: '.$res.' $res2 '.$res2);
- if ( (strlen($pwd) < 6) || (0 === $res) || (0 === $res2)) {
+ if ( (strlen($pwd) < 6) || (0 === $res2)) {
d('failed to validate password');
return false;
20 lib/Lampcms/WebPage.php
View
@@ -320,10 +320,15 @@ protected function setLocale(){
* use the single underscore
* symbol for translation function.
*
- * @param unknown_type $string
- * @param array $vars
+ * @param string $string string to translate
+ *
+ * @param array $vars optional array of replacement vars for
+ * translation
+ *
+ * @return string translated string
*/
protected function _($string, array $vars = null){
+
return $this->Tr->get($string, $vars);
}
@@ -487,6 +492,7 @@ protected function addGFCCode($gfcID){
/**
*
* Add JavaScript for Facebook UI to the page
+ *
* @param string $appId value from !config.ini 'FACEBOOK' -> 'APP_ID'
*/
protected function addFacebookJs($appId){
@@ -573,6 +579,8 @@ protected function loginBySid(){
/**
* Login with Google Friend Connect cookie
* fcauth
+ *
+ * @return $this
*/
protected function loginByGfcCookie(){
if ($this->isLoggedIn()
@@ -1066,8 +1074,16 @@ protected function setTemplateDir(){
}
+ /**
+ * Add the drop-down menu for Language selection
+ * to the page vars
+ *
+ * @return $this
+ */
protected function addLangForm(){
$this->aPageVars['langsForm'] = $this->oRegistry->Locale->getOptions();
+
+ return $this;
}
}
154 translations/messages.ru.xlf
View
@@ -8,7 +8,7 @@
</trans-unit>
<trans-unit id="2">
<source>Unanswered</source>
- <target>Пока без ответов</target>
+ <target>Без ответов</target>
</trans-unit>
<trans-unit id="3">
<source>Tags</source>
@@ -214,6 +214,158 @@
<source>Edited</source>
<target>Редактированно</target>
</trans-unit>
+ <trans-unit id="54">
+ <source>Please enter between {min_tags} and {max_tags} tags, separated by spaces</source>
+ <target>Укажите от {min_tags} до {max_tags} тагов к этому вопросу</target>
+ </trans-unit>
+ <trans-unit id="55">
+ <source>Preview</source>
+ <target>Просмотр</target>
+ </trans-unit>
+ <trans-unit id="56">
+ <source>Enter a descriptive title</source>
+ <target>Напишите заголовок для этого вопроса</target>
+ </trans-unit>
+ <trans-unit id="57">
+ <source>Title</source>
+ <target>Заголовок</target>
+ </trans-unit>
+ <trans-unit id="58">
+ <source>Submit Question</source>
+ <target>Отправить вопрос</target>
+ </trans-unit>
+ <trans-unit id="59">
+ <source>Ask a question</source>
+ <target>Задать вопрос</target>
+ </trans-unit>
+ <trans-unit id="60">
+ <source>Edit Profile</source>
+ <target>Изменить личные данные</target>
+ </trans-unit>
+ <trans-unit id="61">
+ <source>Change Password</source>
+ <target>Изменить пароль</target>
+ </trans-unit>
+ <trans-unit id="62">
+ <source>Email Preferences</source>
+ <target>Настройки уведомлений</target>
+ </trans-unit>
+ <trans-unit id="63">
+ <source>Your Email Subscription Preferences</source>
+ <target>Выберите, когда получать сообщения на адрес электронной почты</target>
+ </trans-unit>
+ <trans-unit id="64">
+ <source>Password updated successfully</source>
+ <target>Пароль изменён</target>
+ </trans-unit>
+ <trans-unit id="65">
+ <source>Save</source>
+ <target>Сохранить</target>
+ </trans-unit>
+ <trans-unit id="66">
+ <source>Current Password</source>
+ <target>Текущий пароль</target>
+ </trans-unit>
+ <trans-unit id="67">
+ <source>Enter new password</source>
+ <target>Новый пароль</target>
+ </trans-unit>
+ <trans-unit id="68">
+ <source>Confirm new password</source>
+ <target>Повторите пароль</target>
+ </trans-unit>
+ <trans-unit id="69">
+ <source>Enter your current password</source>
+ <target>Введите ваш действующий пароль</target>
+ </trans-unit>
+ <trans-unit id="70">
+ <source>This is not the correct password</source>
+ <target>Ваш старый пароль неверен</target>
+ </trans-unit>
+ <trans-unit id="71">
+ <source>Password must be at least 6 characters long and contain at least one number</source>
+ <target>Пароль не должен быть короче 6 символов и содержать по меньшей мере одну букву или цифру</target>
+ </trans-unit>
+ <trans-unit id="72">
+ <source>"New password" and "Confirm new password" do not match</source>
+ <target>Ваше новое подтверждение пароля не соответствует вашему новому паролю. Возможно, вы допустили ошибку при наборе. Пожалуйста, наберите и подтверждите свой новый пароль ещё раз</target>
+ </trans-unit>
+ <trans-unit id="73">
+ <source>Newest</source>
+ <target>Последнии</target>
+ </trans-unit>
+ <trans-unit id="74">
+ <source>Most Voted</source>
+ <target>Популярные</target>
+ </trans-unit>
+ <trans-unit id="75">
+ <source>Most Active</source>
+ <target>Обсуждаемые</target>
+ </trans-unit>
+ <trans-unit id="76">
+ <source>Most recent questions</source>
+ <target>Недавно добавленные</target>
+ </trans-unit>
+ <trans-unit id="77">
+ <source>Questions with most votes</source>
+ <target>С наибольшим количеством оценок</target>
+ </trans-unit>
+ <trans-unit id="78">
+ <source>Questions with most activity</source>
+ <target>Наиболее обсуждаемые</target>
+ </trans-unit>
+ <trans-unit id="79">
+ <source>Questions with highest votes in past 7 days</source>
+ <target>Наибольшее количесвто оценок за последние 7 дней</target>
+ </trans-unit>
+ <trans-unit id="80">
+ <source>Active Questions</source>
+ <target>Наиболее обсуждаемые</target>
+ </trans-unit>
+ <trans-unit id="81">
+ <source>You have contributed to this question</source>
+ <target>Вы автор вопроса или вы комментировали или отвечали на этот вопрос.</target>
+ </trans-unit>
+ <trans-unit id="82">
+ <source>Tags you follow</source>
+ <target>Таги на которые вы подписанны</target>
+ </trans-unit>
+ <trans-unit id="83">
+ <source>You are following this question</source>
+ <target>Вы поднисанны на этот вопрос</target>
+ </trans-unit>
+ <trans-unit id="85">
+ <source>Number of Questions</source>
+ <target>Количество вопросов</target>
+ </trans-unit>
+ <trans-unit id="86">
+ <source>Toggle Unread/Read Status</source>
+ <target>Изменить статус сообщения прочитаное/новое</target>
+ </trans-unit>
+ <trans-unit id="87">
+ <source>Asked</source>
+ <target>Вопрос задан</target>
+ </trans-unit>
+ <trans-unit id="88">
+ <source>Latest answer by</source>
+ <target>Последний ответ от</target>
+ </trans-unit>
+ <trans-unit id="89">
+ <source>Cache Cleared</source>
+ <target>Кэш обнулён</target>
+ </trans-unit>
+ <trans-unit id="90">
+ <source>Register</source>
+ <target>Зарегистрироваться</target>
+ </trans-unit>
+ <trans-unit id="91">
+ <source>Create New Account</source>
+ <target>Создать аккаунт</target>
+ </trans-unit>
+ <trans-unit id="92">
+ <source>Clear Cache</source>
+ <target>Обнулить кэш</target>
+ </trans-unit>
</body>
</file>
</xliff>
275 www/js/min/qa_08102011.js
View
@@ -0,0 +1,275 @@
+var oSL={Regform:function(){}};var $Y=YAHOO,$D=YAHOO.util.Dom,$C=$D.getElementsByClassName,$CONN=YAHOO.util.Connect,$=YAHOO.util.Dom.get,$LANG=YAHOO.lang,$COOKIE=YAHOO.util.Cookie,$J=YAHOO.lang.JSON,$W=YAHOO.widget,$L=YAHOO.log;LampcmsException=function(message,exceptionName){this.message=message;this.name=exceptionName||"LampcmsException";};oAjaxObject={handleSuccess:function(o){var eLastDiv,json,sDoc,sTpl,errDiv,strMessage='',eLogin=$("loginHead"),strContentType=$LANG.trim(o.getResponseHeader["Content-Type"]);switch(strContentType){case'text/json; charset=UTF-8':case'text/javascript; charset=UTF-8':try{json=$J.parse(o.responseText);}catch(e){alert("Invalid json data in responceText "+$LANG.dump(e)
++" strContentType "+strContentType+"<br>oRespnose: "
++$LANG.dump(o.responseText));}
+switch(true){case json.hasOwnProperty('exception'):alert(json.exception);break;case json.hasOwnProperty('redirect'):window.location.assign(json.redirect);break;case json.hasOwnProperty('message'):eLogin.innerHTML=json.message;oSL.fColorChange(eLogin,'#00FF00','#FFFFFF');break;case json.hasOwnProperty('quickreg'):eLastDiv=document.createElement('div');eLastDiv.innerHTML=json.quickreg;document.body.appendChild(eLastDiv);oSL.Regform.getInstance().show();break;}
+break;}},handleFailure:function(o){alert($LANG.dump(o));}};oSL={toString:function(){return'object oSL';},getQuickRegForm:function(){if(oSL.Regform&&oSL.Regform.hasDialog()){oSL.Regform.getInstance().show();}else{$CONN.asyncRequest("GET","/index.php?a=getregform",oSL.oCallback);}},hideRegForm:function(){if(oSL.Regform){oSL.Regform.getInstance().hide();window.location.reload();}
+return false;},getMeta:function(sMetaName,bAsElement){$L('182 looking for meta tag '+sMetaName);var el,i,aMeta=document.getElementsByTagName('meta');$L('43 '+$LANG.dump(aMeta)+' total metas: '+aMeta.length);if(!aMeta){$L('45 no meta tags in document','error');return false;}
+for(i=0;i<aMeta.length;i+=1){if(aMeta[i].name&&(aMeta[i].name===sMetaName)&&aMeta[i].content){if(bAsElement){el=aMeta[i];$L('213 meta tag element '+el);return el;}
+return aMeta[i].content;}}
+return false;},getToken:function(){$L('166 getToken');var token=this.getMeta('version_id');return token;},isLoggedIn:function(){$L('64 this is: '+this);var ret,uid=this.getMeta('session-uid');$L('148 uid: '+uid);ret=(uid&&(uid!=='')&&(uid!=='0'));$L('66 ret: '+ret);return ret;},getTZO:function(){var tzo,nd=new Date();tzo=(0-(nd.getTimezoneOffset()*60));return tzo;},setTZOCookie:function(){$L('109 this is: '+this);var tzo=this.getTZO();$L('117 tzo: '+tzo);$COOKIE.set("tzo",tzo,{path:"/"});},oCallback:{success:oAjaxObject.handleSuccess,failure:oAjaxObject.handleFailure,scope:oAjaxObject},fAddIcon:function(s,b){var el=(typeof(s)==='string')?$(s):s;if(!this.eLoader){this.eLoader=document.createElement("img");this.eLoader.src='/images/ajax-loader.gif';this.eLoader.id="loadericon";}
+if(this.eLoader){if(b&&b===true){el.innerHTML='';}
+el.appendChild(this.eLoader);}},fRemoveIcon:function(){if(this.eLoader&&this.eLoader.parentNode){$L('include.js 118 eLoader parent: '+this.eLoader.parentNode
++' id: '+this.eLoader.parentNode.id);this.eLoader.parentNode.removeChild(this.eLoader);}},fCompareForms:function(oNewForm,oOldForm){$L($CONN.setForm(oNewForm));$L($CONN.setForm(oOldForm));if($CONN.setForm(oNewForm)===$CONN.setForm(oOldForm)){return true;}
+return false;},fColorChange:function(el,sFromColor,sToColor){$L('starting fColorChange for '+el);var myChange,curBg,myChangeBack,element=(typeof el==='string')?$(el):el,sToColor=(sToColor&&typeof sToColor==='string')?sToColor:'#FF0000',sFromColor=(sFromColor&&typeof sFromColor==='string')?sFromColor:'#FFFFFF';$L('element is: '+element);if(element){curBg=$D.getStyle(element,'background-color');$D.setStyle(element,'background-color',sFromColor);myChange=new YAHOO.util.ColorAnim(element,{backgroundColor:{to:sToColor}});myChangeBack=function(){element.style.backgroundColor=curBg;};myChange.onComplete.subscribe(myChangeBack);myChange.animate();}},fParseQf:function(json){$L($LANG.dump(json));var strMessage='',aAvatars,i=0,el,formField,eMessageDiv=$('qfe');switch(true){case json.hasOwnProperty('exception'):if(json.hasOwnProperty('errHeader')){strMessage+='<u>'+json.errHeader+'</u><br>';}
+eMessageDiv.innerHTML='<div id="qfErrors">'+strMessage
++json.exception+'</div>';break;case json.hasOwnProperty('errors'):if(json.hasOwnProperty('errHeader')){strMessage+='<u>'+json.errors.errHeader+'</u><br>';}
+eMessageDiv.innerHTML='<div id="qfErrors">'+strMessage
++json.errors.errMessage+'</div>';this.aEls=[];for(formField in json){if(json.hasOwnProperty(formField)&&json[formField].hasOwnProperty('err')){el=$('a'+formField);if(el){el.style.backgroundColor='#FFFFCC';this.aEls.push(el);}}}
+this.fColorChange('qfmessage','#FF0000','#FFFFFF');break;}
+if(oSL.oFrm&&oSL.oFrm.elBtnSubmit){oSL.oFrm.elBtnSubmit.disabled=false;}
+var elPbar=$('progressBar'),elAvatarField=$('aavatar');if(elPbar){elPbar.parentNode.removeChild(elPbar);}
+if(elAvatarField){$D.setStyle(elAvatarField,'display','block');}}};oSL.tweet=(function(){var oDialog;var siteTitle=oSL.getMeta('site_title');var siteUrl=oSL.getMeta('site_url');var token=oSL.getToken();return{getInstance:function(){var eRootDiv,oFrm,siteDescription,sForm;if(!oDialog){if(!$('dialog1')){sForm='<div class="hd">Please enter your information</div>'
++'<div class="bd"><hr/>'
++'<form method="POST" action="/index.php">'
++'<input type="hidden" name="a" value="tweet">'
++'<input type="hidden" name="token" value="'
++token
++'">'
++'<h3 class="tweetdlg">Tweet this:</h3>'
++'<div class="clear"></div>'
++'<textarea cols="44" rows="5" name="tweet">'
++$('twinvite').title
++' '
++siteTitle
++' '
++siteUrl
++'</textarea>'
++'<div class="clear"></div>'+'</form>';eRootDiv=document.createElement('div');eRootDiv.id='dialog1';document.body.appendChild(eRootDiv);eRootDiv.innerHTML=sForm;}
+oDialog=new $W.Dialog("dialog1",{width:"30em",fixedcenter:true,visible:false,constraintoviewport:true,buttons:[{text:"Submit",handler:function(){this.submit();},isDefault:true},{text:"Cancel",handler:function(){this.cancel();}}]});oDialog.beforeSubmitEvent.subscribe(function(){$L('before submit tweet');});oDialog.callback={success:function(o){alert('Tweet sent');},failure:function(o){alert('Tweet not sent');}};oDialog.setHeader("Invite Your Friends");oDialog.render(document.body);}
+return oDialog;},destroy:function(){if(oDialog){oDialog.destroy();}},hide:function(){if(oDialog){oDialog.hide();}},setTextArea:function(s){},toString:function(){return'object oDialog created with oSL.dialog()';}};})();oSL.Regform=(function(){var errDiv,oDialog,aDialogs={},oPrompt,handleSubmit=function(){this.submit();},handleCancel=function(){$L('41 clicked on Cancel this is: '+this);oSL.Regform.getPrompt().show();},handleContinue=function(){this.hide();},handleExit=function(){var eAvatar=$('regext');$L('handling exit');this.hide();oSL.Regform.getInstance().hide();if(eAvatar){$COOKIE.set("dnd","1",{path:"/"});}},handleSuccess=function(o){var response,i,aButtons,oMyDialog=oSL.Regform.getInstance();oSL.Regform.enableButtons();aButtons=oSL.Regform.getInstance().getButtons();for(i=0;i<aButtons.length;i+=1){$L('button '+i+' is '+aButtons[i]);}
+response=o.responseText;try{json=$J.parse(o.responseText);switch(true){case(json.hasOwnProperty('exception')):setError(json);break;case(json.hasOwnProperty('action')&&(json.action==='done')):oMyDialog.setHeader('Welcome!');oMyDialog.setFooter('');oMyDialog.setBody(json.body);break;}}catch(e){alert("Invalid json data in responceText "+$LANG.dump(e)+"Respnose: "+$LANG.dump(o.responseText));}},handleFailure=function(o){oSL.Regform.enableButtons();oSL.Regform.getInstance().setBody('<p>boo hoo, something is wrong</p>');$L('47 fail ','warn');},setError=function(oError){var i,errDiv=$('form_error'),aInputs,message=oError.exception,oRegform=oSL.Regform.getInstance(),myForm=oRegform.form;errDiv.innerHTML=message;oSL.fColorChange(errDiv,'#FFFFFF','#FF0000');if(oError.type&&('LampcmsCaptchaLimitException'===oError.type)){$LANG.later(2000,oRegform,'destroy');}
+if(oError.hasOwnProperty('fields')){aInputs=oError.fields;for(i=0;i<aInputs.length;i+=1){if(myForm.hasOwnProperty(aInputs[i])){myForm[aInputs[i]].style.backgroundColor="#CCFFCC";}}}
+if(oError.hasOwnProperty('captcha')){if(oError.captcha.public_key&&oError.captcha.hncaptcha&&oError.captcha.img){myForm.public_key.value=oError.captcha.public_key;myForm.private_key.value='';myForm.hncaptcha.value=oError.captcha.hncaptcha;$('imgcaptcha').innerHTML=oError.captcha.img;}}else{if(myForm.private_key&&oError.type){myForm.private_key.disabled=true;}}},aButtonsDone=[{text:"<-- Return to page",handler:function(){alert('this is '+this);},isDefault:true},{text:"Go to Profile editor -->",handler:function(){alert('go to profile');}}],startProgress=function(o){oSL.Regform.disableButtons();};return{getInstance:function(){$L('cp 13','warn');if(!oDialog){$L('cp 15','warn');$D.removeClass("regdiv","yui-pe-content");$L('cp 17','warn');oDialog=new $W.Dialog("regdiv",{width:"50em",fixedcenter:"contained",visible:false,constraintoviewport:false,hideaftersubmit:false,draggable:true,close:false,modal:true,buttons:[{text:"Create Your Account",handler:handleSubmit,isDefault:true},{text:"Cancel",handler:handleCancel}]});oDialog.callback={success:handleSuccess,failure:handleFailure};oDialog.validate=function(){var at,checkEmail,tzo,message,aInputs=[],myForm=this.form,nd=new Date(),data=this.getData();$L('data: '+$LANG.dump(data));tzo=(0-(nd.getTimezoneOffset()*60));if((myForm.tzo)&&(tzo)){myForm.tzo.value=tzo;}
+checkEmail=function(str){var at="@",dot=".",lat=str.indexOf(at),lstr=str.length,ldot=str.indexOf(dot);if(str.indexOf(at)===-1||str.indexOf(at)===0||str.indexOf(at)===lstr){return false;}
+if(str.indexOf(dot)===-1||str.indexOf(dot)===0||str.indexOf(dot)===lstr){return false;}
+if(str.substring(lat-1,lat)===dot||str.substring(lat+1,lat+2)===dot){return false;}
+if((str.indexOf(at)===-1)||(str.indexOf(at,(lat+1))!==-1)||(str.indexOf(dot,(lat+2))===-1)||(str.indexOf(" ")!==-1)){return false;}
+return true;};switch(true){case(data.email===""):message="Please enter email address";aInputs.push('email');break;case(data.username===""):message="Please enter Username";aInputs.push('username');break;case(data.hasOwnProperty('private_key')&&(""===data.private_key)):message="Please enter the text from image";aInputs.push('private_key');break;case(!checkEmail(data.email)):message="Email address appears to be invalid<br>Please enter a valid Email";aInputs.push('email');break;default:return true;}
+setError({exception:message,fields:aInputs});return false;};oDialog.asyncSubmitEvent.subscribe(function(type,args){var connectionObject=args[0];startProgress();});oDialog.render($('lastdiv'));}
+return oDialog;},toString:function(){return'object oSL.Regform';},getPrompt:function(){if(!oPrompt){$L('making prompt');oPrompt=new $W.SimpleDialog("simpledialog1",{width:"300px",fixedcenter:true,zindex:99,visible:false,draggable:false,close:true,modal:true,text:"Do you want to continue?",icon:$W.SimpleDialog.ICON_ALARM,constraintoviewport:true,buttons:[{text:"Continue registration",handler:handleContinue,isDefault:true},{text:"Exit registration",handler:handleExit}],effect:[{effect:$W.ContainerEffect.FADE,duration:0.2}]});oPrompt.setHeader("Are you sure?");oPrompt.render(document.body);}
+$L('176 oPrompt: '+oPrompt,'warn');return oPrompt;},disableButtons:function(){var i,aBtns;$L('105 this is: '+this,'warn');if(oDialog){aBtns=oDialog.getButtons();for(i=0;i<aBtns.length;i+=1){aBtns[i].set('disabled',true);}}},enableButtons:function(){var i,aBtns;$L('105 this is: '+this,'warn');if(oDialog){aBtns=oDialog.getButtons();for(i=0;i<aBtns.length;i+=1){aBtns[i].set('disabled',false);}}},setButtonsDone:function(){oDialog.cfg.queueProperty("buttons",aButtonsDone);},destroy:function(){if(oDialog){oDialog.destroy();}},hasDialog:function(){if(oDialog&&oDialog.body){return true;}
+return false;}};})();YUI({}).use('node','dump','event','escape','gallery-storage-lite','gallery-overlay-extras','dd-plugin','anim','transition','yui2-container','yui2-editor','yui2-element','yui2-button','yui2-resize','yui2-animation','io-form','json','jsonp','imageloader','autocomplete','autocomplete-filters','autocomplete-highlighters','gallery-node-tokeninput','cookie',function(Y,result){var YAHOO=Y.YUI2,TTT2=Y.all('.ttt2'),ttB,ttB2,oMetas={},loader,getMeta,setMeta,getToken,ensureLogin,initTooltip,getEditedText,previewDiv,preview,MysubmitForm,showDeleteForm,showRetagForm,showShredForm,showCommentForm,showCommentReplyForm,addAdminControls,checkExtApi,showFlagForm,showCloseForm,codeButtons={},initAutoComplete,getAlerter,isModerator,isEditable,initFBSignup,Twitter,showEditComment,setToken,getReputation,isLoggedIn,getViewerId,oCTabs={},foldGroup,revealComments,dnd=false,res=Y.one('#body_preview'),write=function(str){var d=new Date();str+=' :: '+d.toTimeString();if(res){res.set('innerHTML',str);}},tplComform='<div id="comm_wrap_{divID}" class="fl cb{extraClass}">'
++'<form action="/index.php" id="add-comment-{formID}" class="comform" method="post">'
++'<input type="hidden" name="a" value="addcomment">'
++'<input type="hidden" name="rid" value="{resID}">'
++'<input type="hidden" name="parentid" value="{parentID}">'
++'<input type="hidden" name="token" value="{token}">'
++'<table class="cb fr tbl_comment">'
++'<tr><td width="60px" class="com_icons" valign="top"></td>'
++'<td class="com_main">'
++'<textarea name="com_body" cols="60" rows="3" class="com_bo" style="display: block; padding: 2px;"></textarea>'
++'</td>'
++'<td class="com_button" valign="top">'
++'<input type="submit" name="doit" class="btn_comment" value="{comment}">'
++'</td>'
++'</tr>'
++'{commentTip}'
++'</table>'
++'</form></div>',saveToStorage=function(){Y.StorageLite.on('storage-lite:ready',function(){var tags,html=editor.saveHTML();saveTitle();saveTags();Y.StorageLite.setItem(getStorageKey(),html);write('Draft saved..');});},commentTip='<tr><td></td><td colspan="2" class="lighttext">Enter at least 16 characters<br>Allowed mini-Markdown formatting: _italic_ and **bold**</td></tr>',eForm=Y.one('.qa_form'),eAskTA,reputation,viewerId=null,bModerator=1,eInputTitle,eInputTags,eTagsHint,eBodyHint,eTitleHint,aComHand,oVotes={},editor,oAlerter,loadingMasks=[],getStorageKey=function(){var formName;if(!eForm){return null;}
+return eForm.get('name');},initTagInput=function(el){Y.Plugin.TokenInput.prototype._afterBlur=function(e){var that=this;if(this.get('tokenizeOnBlur')){setTimeout(function(){that._tokenizeValue(null,null,{all:true});},100);}};var input=(el)?el:Y.one("#id_tags");if(input){Y.one(input).plug(Y.Plugin.TokenInput,{delimiter:' '}).plug(Y.Plugin.AutoComplete,{resultListLocator:'ac',resultTextLocator:'tag',resultFilters:'charMatch',resultHighlighter:'charMatch',source:'/index.php?a=taghint&q={query}&ajaxid=1&callback={callback}'});}},mmdDecode=function(s){var bold,ret,em=/(\<em>|\<\/em>)/g;bold=/(\<strong>|\<\/strong>)/g;ret=s.replace(em,'_');ret=ret.replace(bold,'**');return ret;},_handleWindowClose=function(){var el=this.currentElement[0];el=new Y.Node(el);if(el&&el.hasClass('yui-media')){el.remove();}
+Y.one("#embed_url").set('value','');Y.Event.purgeElement("#btn_addvideo");this.nodeChange();},parseUri=function(sourceUri){var uriParts,i=0,uri={},uriPartNames=["source","protocol","authority","domain","port","path","directoryPath","fileName","query","anchor"];uriParts=new RegExp("^(?:([^:/?#.]+):)?(?://)?(([^:/?#]*)(?::(\\d*))?)?((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[\\?#]|$)))*/?)?([^?#/]*))?(?:\\?([^#]*))?(?:#(.*))?").exec(sourceUri);for(i=0;i<10;i++){uri[uriPartNames[i]]=(uriParts[i]?uriParts[i]:"");}
+if(uri.directoryPath.length>0){uri.directoryPath=uri.directoryPath.replace(/\/?$/,"/");}
+return uri;},getYTVidId=function(url){var myID,getID,path,a=parseUri(url),re=/(?:v=)([^&\?]*)(?:[&]*)/gi;path=a['path'];if(path.length<2||(-1===path.indexOf('/'))){return false;}
+path=path.substr(1);if('watch'!==path){if(/(\?|&)/.test(path)){return false;}
+return path;}else if(!a.hasOwnProperty('query')||!a['query']||a['query'].length<3){return false;}else{myID=re.exec(a['query']);if(!myID||myID.length<2||myID[1].length<1){return false;}
+return myID[1];}},parseYTInput=function(){var url,apiURL='http://gdata.youtube.com/feeds/api/videos/{id}?v=2&alt=jsonc&callback=',handleJSONP,imgId,myinput1=(Y.one("#embed_url"))?Y.one("#embed_url").get('value'):null;handleJSONP=function(resp){var _doc=editor._getDoc(),el,html,imgId,title='',desc='',err='Error returned from Youtube API. ',tpl='<a href="http://youtu.be/{id}" class="ajax ytlink ttt" rev="{id}" title="{t}"><img src="http://i.ytimg.com/vi/{id}/default.jpg" alt="YouTube video" width="120px" height="90px"/></a>';tpl+='<a href="http://youtu.be/{id}" class="ajax ytplay ttt" rev="{id}" title="{t}"><img src="/images/play.png" alt="Play" width="44px" height="44px"/></a>';if(resp.error){if(resp['error']['message']){err+=resp['error']['message'];alert(err);return;}}else{imgId=resp['data']['id'];if(resp['data']&&resp.data['title']){title=resp.data['title'];}
+if(resp['data']&&resp.data['description']){desc=resp.data['description'];}
+el=editor._swapEl(editor.currentElement[0],'div',function(el){YAHOO.util.Dom.addClass(el,'ajax');YAHOO.util.Dom.addClass(el,'ytvideo');YAHOO.util.Dom.setStyle(el,'width','120px');YAHOO.util.Dom.setStyle(el,'height','90px');YAHOO.util.Dom.setStyle(el,'min-height','90px');YAHOO.util.Dom.setStyle(el,'margin-bottom','5px');});html=Y.Lang.sub(tpl,{id:imgId,t:title});el.innerHTML=html;el.parentNode.appendChild(_doc.createElement("br"));editor.focus();editor.closeWindow();editor.get('panel').syncIframe();}};if(myinput1&&''!==myinput1){imgId=getYTVidId(myinput1);if(false===imgId){alert('URL of YouTube Video does not look correct');return;}
+url=Y.Lang.sub(apiURL,{id:imgId});url+='{callback}';Y.jsonp(url,handleJSONP);}},_handleMediaWindow=function(){var btn,win=new YAHOO.widget.EditorWindow('insertmedia',{width:'415px'});win.setHeader('Add YouTube Video');this.openWindow(win);Y.on("click",parseYTInput,"#btn_addvideo");this.on('afterOpenWindow',function(){this.get('panel').syncIframe();},this,true);},mmdEncode=function(s){var bold,ret,em=/(\<em>|\<\/em>)/g;bold=/(\<strong>|\<\/strong>)/g;ret=s.replace(em,'_');ret=ret.replace('/(\*\*)([^\*]+)(\*\*)/g','<strong>\\2</strong>');return ret;},incrementVoteCounter=function(qid){var ret;if(!oVotes.hasOwnProperty(qid)){oVotes[qid]=1;}else{oVotes[qid]=(oVotes[qid]+1);}
+ret=(oVotes[qid]<5);return ret;},getTZO=function(){var tzo,nd=new Date();tzo=(0-(nd.getTimezoneOffset()*60));return tzo;},showLoading=function(node,header){var target,box,label=(header)?header:'Loading...',width,height;if(!loader){loader=new Y.Overlay({centered:true,srcNode:"#loading",width:"100px",headerContent:"Loading...",bodyContent:"<img src='/images/loading-bar.gif'>",zIndex:1000});Y.one("#loading").removeClass('hidden');loader.render();}
+loader.set('headerContent',label);if(node&&(node instanceof Y.Node)){loader.set("centered",node);}else{loader.set("centered",true);}
+loader.set("constrain",true);loader.show();},hideLoading=function(node){if(loader){loader.hide();}},initGfcSignup=function(){if((typeof google==='undefined')||!google.friendconnect){return;}
+google.friendconnect.requestSignIn();return;},storeReadEtag=function(){var sKey,uid,etag=getMeta('etag'),qid;if(etag){qid=getMeta('qid');if(qid){uid=getViewerId();etag=parseInt(etag,10);sKey='q-'+qid+'_'+uid;Y.StorageLite.setItem(sKey,etag);}}},setReadLinks=function(){var uid,eDivs,stored,oStorage=Y.StorageLite,eQlist=Y.one('.qlist');if(!eQlist){return;}
+eDivs=eQlist.all('.qs');if(!eDivs||eDivs.size()===0){return;}
+uid=getViewerId();eDivs.each(function(){var qid,etag,stored,span;qid=this.get('id');etag=this.getAttribute('lampcms:i_etag');stored=oStorage.getItem(qid+'_'+uid);if(stored){if(stored===etag){this.one('a.ql').addClass('read');span=this.one('span.ru');if(span){span.removeClass('unread');span.addClass('read');span.setAttribute('lampcms:ttt','No Unread Items. Click to toggle status');}}}});},toggleRead=function(el){var curStatus,qid,etag,qsDiv,uid=getViewerId(),link;curStatus=(el.test('.unread'))?'unread':'read';qsDiv=el.ancestor("div.qs");qid=qsDiv.get('id');link=qsDiv.one('a.ql');etag=qsDiv.getAttribute('lampcms:i_etag');etag=parseInt(etag,10);sKey=qid+'_'+uid;if('unread'===curStatus){link.removeClass('unread').addClass('read');el.removeClass('unread').addClass('read').setAttribute('lampcms:ttt','No Unread items. Click to toggle status');Y.StorageLite.setItem(sKey,etag);}else{link.removeClass('read').addClass('unread');el.removeClass('read').addClass('unread').setAttribute('lampcms:ttt','Unread items. Click to toggle status');Y.StorageLite.removeItem(sKey);}},handleVote=function(el){var request,id=el.get('id');switch(true){case el.test('.thumbupon'):el.removeClass('thumbupon');el.addClass('thumbup');break;case el.test('.thumbup'):el.removeClass('thumbup');el.addClass('thumbupon');break;case el.test('.thumbdownon'):el.removeClass('thumbdownon');el.addClass('thumbdown');break;case el.test('.thumbdown'):el.removeClass('thumbdown');el.addClass('thumbdownon');break;}
+if(incrementVoteCounter(id)){request=Y.io(el.get('href'));}},makeYoutubePlayer=function(el){var myAnim,div,id,url,player;div=el.ancestor("div");id=el.get("rev");player='<iframe width="480" height="390" src="http://www.youtube.com/embed/'+id+'?rel=0" frameborder="0" allowfullscreen></iframe>';div.addClass('bg_black');myAnim=new Y.Anim({node:div,to:{width:480,height:390}});myAnim.set('duration',0.6);myAnim.set('easing',Y.Easing.easeOut);myAnim.on('end',function(){myAnim.get('node').set('innerHTML',player);});myAnim.run();},handleLikeComment=function(el){var parent,likesdiv,likes,id=el.get('id');if(el.test('.thumbupon')){return;}
+el.addClass('thumbupon');id=id.substr(7);parent=el.ancestor("div");likesdiv=parent.next(".c_likes");likes=likesdiv.get("text");likes=(!likes)?0:parseInt(likes,10);likesdiv.set("text",(likes+1));Y.io('/index.php?a=likecomment&commentid='+id);},getQuickRegForm=function(){oSL.getQuickRegForm();},initFbInvite=function(target){var siteTitle,siteUrl,siteDescription,caption;if(typeof FB==='undefined'){return;}
+siteTitle=getMeta('site_title');siteUrl=getMeta('site_url');siteDescription=target.get('title');caption=getMeta('site_description');FB.ui({method:'stream.publish',message:'I joined this site with Facebook Connect button. You should check it out too',attachment:{name:siteTitle,caption:caption,description:siteDescription,href:siteUrl},action_links:[{text:siteTitle,href:siteUrl}],user_message_prompt:'Invite your Facebook Friends to join this site'},function(response){});},handleModalForm=function(e){var request,cfg,form=e.currentTarget;e.halt();cfg={method:'POST',form:{id:form,useDisabled:true}};oAlerter.hide();showLoading();request=Y.io('/index.php',cfg);},handleCommentForm=function(e){var body,cfg,request,numChars,form=e.currentTarget;e.halt();e.preventDefault();body=form.one("textarea[name=com_body]");numChars=body.get("value").length;if(body&&(numChars<10)){alert('Comment must be at least 10 characters long');return;}
+if(body&&(numChars>600)){alert('Comment must be at under 600 chars long. Please remove '
++(numChars-600)+' characters from your comment');return;}
+cfg={method:'POST',form:{id:form,useDisabled:true}};if(oAlerter){oAlerter.hide();}
+showLoading(form.ancestor('div'));request=Y.io('/index.php',cfg);},handleAjaxLinks=function(e){var ancestor,id,res,rtype,restype,resID,fbappid,fbcookie,el=e.currentTarget,target=e.target;id=el.get('id');switch(true){case el.test('.qpages'):if('A'===e.target.get('tagName')&&Y.one(".paginated")){e.halt();handlePagination(e.target);}
+break;case el.test('.ext_api'):checkExtApi(el);break;case el.test('span.ru'):toggleRead(el);break;case el.test('.vote'):e.halt();if(ensureLogin()){handleVote(el);}
+break;case el.test('.c_like'):e.halt();if(ensureLogin()){handleLikeComment(el);}
+break;case el.test('.ytlink'):case el.test('.ytplay'):e.halt();makeYoutubePlayer(el);break;case el.test('.fbsignup'):initFBSignup();break;case el.test('.gfcsignin'):initGfcSignup();break;case el.test('.twsignin'):Twitter.startDance();break;case el.test('.add_tumblr'):Twitter.startDance('/index.php?a=logintumblr',680,540);break;case el.test('.add_linkedin'):Twitter.startDance('/index.php?a=loginlinkedin',640,480);break;case el.test('.add_blogger'):Twitter.startDance('/index.php?a=connectblogger',680,540);break;case el.test('.inreply'):(function(){var div,parentDiv,id=el.get('id');id=id.substr(8);parentDiv=Y.one("#comment-"+id);div=el.ancestor('div.com_wrap');if(parentDiv){if(parentDiv.hasClass('parent_comment2')){parentDiv.removeClass('parent_comment2');parentDiv.removeClass('parent_comment');if(div&&div.hasClass('parent_comment2')){div.removeClass('parent_comment2');}}else{parentDiv.addClass('parent_comment2');if(div){div.addClass('parent_comment2');}}}})();break;case(id==='gfcset'):if((typeof google!=='undefined')&&google.friendconnect){google.friendconnect.requestSettings();}
+break;case(id==='gfcinvite'):if((typeof google!=='undefined')&&google.friendconnect){google.friendconnect.requestInvite();}
+break;case(id==='fbinvite'):initFbInvite(el);break;case(id==='twinvite'):oTweet=oSL.tweet.getInstance();oTweet.show();break;case(el.test('.change_image')):if(Y.one("#avatar_upload")){Y.one("#avatar_upload").removeClass('pic_upload');}
+break;case(id==='logout'):e.preventDefault();e.halt();showLoading(el);fbappid=getMeta('fbappid');if((typeof FB!=='undefined')&&fbappid&&FB.getSession()){FB.logout(function(response){fbcookie="fbs_"+fbappid;Y.Cookie.remove(fbcookie);window.location.assign('/index.php?a=logout');});}else{window.location.assign('/index.php?a=logout');}
+break;case el.test('.flag'):ancestor=el.ancestor("div.controls");if(ancestor){restype=(ancestor.test('.question'))?'q':'a';resID=ancestor.get('id');resID=resID.substr(4);}else{ancestor=el.ancestor("div.com_flag");if(ancestor){restype='c';resID=el.get('id');resID=resID.substr(6);}}
+if(ancestor){showFlagForm({'rid':resID,'rtype':restype});}
+break;case el.test('.retag'):ancestor=el.ancestor("div.controls");if(ancestor){resID=ancestor.get('id');resID=resID.substr(4);showRetagForm(resID);}
+break;case el.test('.sortans'):e.halt();getSortedAnswers(el);break;case el.test('.stick'):window.location.assign('/index.php?a=stick&qid='+getMeta('qid'));break;case el.test('.unstick'):window.location.assign('/index.php?a=unstick&qid='+getMeta('qid'));break;case el.test('.close'):ancestor=el.ancestor("div.controls");if(ancestor){resID=ancestor.get('id');resID=resID.substr(4);showCloseForm(resID);}
+break;case el.test('.del'):ancestor=el.ancestor("div.controls");if(ancestor){resID=ancestor.get('id');resID=resID.substr(4);if(ancestor.test('.com_tools')){deleteComment(resID);}else{rtype=(ancestor.test('.question'))?'q':'a';showDeleteForm({'rid':resID,'rtype':rtype});}}
+break;case el.test('.edit'):ancestor=el.ancestor("div.controls");if(ancestor){e.halt();e.preventDefault();resID=ancestor.get('id');resID=resID.substr(4);if(ancestor.test('.com_tools')){if(!isEditable(ancestor)){alert('You cannot edit comments that are older than '+getMeta('comments_timeout')+' minutes');return;}else{showEditComment(resID);}}else{restype=(ancestor.test('.question'))?'q':'a';window.location.assign('/index.php?a=edit&rid='+resID+'&rtype='+restype);}}
+break;case el.test('.com_link'):e.preventDefault();showCommentForm(el);break;case el.test('.com_reply_link'):e.preventDefault();showCommentReplyForm(el);break;case el.test('.btn_shred'):if(ensureLogin()){showShredForm(el.get('id'));}
+break;case el.test('.btnfollow'):handleFollow(el);break;}},handlePagination=function(el){var href,qpages;qpages=el.ancestor("div.qpages");if(!el.hasAttribute('href')){return;}
+href=el.getAttribute('href');if(qpages){showLoading(qpages);Y.io(href);}},getSortedAnswers=function(el){var href,curTab,curTabId,sortby=el.get('id'),qid,qtype=Y.one("#qtypes"),eTab=el.ancestor("div").next("div.sortable")||Y.one(".sortable");if(el.test(".qtype_current")){return;}
+curTab=el.ancestor("div").one(".qtype_current");if(curTab){curTabId=curTab.get("id");if(!oCTabs.hasOwnProperty(curTabId)){oCTabs[curTabId]=eTab.getContent();}}
+el.siblings().removeClass('qtype_current');el.addClass('qtype_current');if(oCTabs.hasOwnProperty(sortby)&&oCTabs[sortby].length>0){eTab.setContent(oCTabs[sortby]);foldGroup.fetch();}else{showLoading(eTab);href=el.getAttribute('href');href=('#'===href)?'/index.php?a=getanswers&qid='+getMeta('qid')+'&sort='+sortby:href;Y.io(href,{'arguments':{'sortby':sortby}});}},handleFollow=function(el){if(!ensureLogin()){return;}
+el.removeClass('unfollow');var viewerDiv,title,controls,id,resID,ftype='q',follow='on',form,oLabels={'q':'question','u':'user','t':'tag'};resID=el.getAttribute('lampcms:follow');ftype=el.getAttribute('lampcms:ftype');viewerDiv=Y.one("#flwr_"+getViewerId());if(el.test('.following')){controls=Y.one('#res_'+resID);if(controls){if(controls.test('.uid-'+getViewerId())){if(!confirm('Are you sure you want to unfollow your own question?')){el.one('span.icoc').removeClass('del').addClass('check');el.one('span.flabel').set('text','Following');return;}}}
+title=(ftype==='u')?'Follow':'Follow this '+oLabels[ftype];el.removeClass('following').addClass('follow');el.set('title',title);el.one('span.icoc').removeClass('check').addClass('cplus');el.one('span.flabel').set('text',title);follow='off';if(viewerDiv){viewerDiv.hide('fadeOut');}}else{title='You are following this '+oLabels[ftype];el.removeClass('follow').addClass('following');el.set('title',title);el.one('span.icoc').removeClass('cplus').removeClass('del').addClass('check');el.one('span.flabel').set('text','Following');follow='on';if(viewerDiv){viewerDiv.show('fadeIn');}}
+form='<form name="form_f" action="/index.php">'
++'<input type="hidden" name="a" value="follow">'
++'<input type="hidden" name="ftype" value="'+ftype+'">'
++'<input type="hidden" name="follow" value="'+follow+'">'
++'<input type="hidden" name="f" value="'+resID+'">'
++'<input type="hidden" name="token" value="'+getToken()+'">';form=Y.one('body').appendChild(form);cfg={method:'POST',form:{id:form}};request=Y.io('/index.php',cfg);return;},handleOver=function(e){var id,parent,el=e.currentTarget;switch(true){case el.test('.inreply'):id=el.get('id');id=id.substr(8);if(Y.one("#comment-"+id)){Y.one("#comment-"+id).addClass('parent_comment');}
+break;case el.test('.following'):if(!el.hasClass('unfollow')){el.addClass('unfollow');el.one('span.icoc').removeClass('check').addClass('del');el.one('span.flabel').set('text','Unfollow');}
+break;}},handleOut=function(e){var id,parent,el=e.currentTarget;switch(true){case el.test('.inreply'):id=el.get('id');id=id.substr(8);if(Y.one("#comment-"+id)){Y.one("#comment-"+id).removeClass('parent_comment');}
+break;case(el.test('.following')):el.removeClass('unfollow');el.one('span.icoc').removeClass('dev').addClass('check');el.one('span.flabel').set('text','Following');break;}},revealHidden=function(e){var els=(e)?e.all('.reveal'):Y.all('.reveal');if(els){els.each(function(){if(this.test('.owner')){if(this.test('.oid-'+getViewerId())){this.removeClass('hidden');}}else{this.removeClass('hidden');}});}},handleSuccess=function(ioId,o,args){hideLoading();var data,target,paginated,scoreDiv,comDivID,eDiv,eRepliesDiv,sContentType=Y.Lang.trim(o.getResponseHeader("Content-Type"));if('text/json; charset=UTF-8'!==sContentType){alert('Invalid Content-Type header: '+sContentType);return;}
+if(undefined===o.responseText){alert('No text in response');return;}
+try{data=Y.JSON.parse(o.responseText);}catch(e){alert("Error parsing response object"+e+"<br>o.responseText: "+o.responseText);return;}
+if(data.exception){if(data.type&&'Lampcms\\MustLoginException'===data.type){ensureLogin(true);}else{alert(data.exception);}}
+if(data.alert){alert(data.alert);}
+if(data.success){alert(data.alert);}
+if(data.replace&&data.replace.target&&data.replace.content){Y.one("#"+data.replace.target).set('innerHTML',data.replace.content);foldGroup.fetch();initTooltip();revealHidden();}
+if(data.reload){if(data.reload>0){Y.later(data.reload,this,function(){window.location.reload(true);});}else{window.location.reload(true);}}
+if(data.formError){if(Y.one(".form_error")){Y.one(".form_error").set('innerHTML',data.formError);}else{alert(data.formError);}
+return;}
+if(data.formElementError){setFormError(data.formElementError);return;}
+if(data.setmeta&&data.setmeta.key&&data.setmeta.val){setMeta(data.setmeta.key,data.setmeta.val);}
+if(data.paginated){paginated=Y.one(".paginated");if(paginated){paginated.setContent(data.paginated);foldGroup.fetch();initTooltip();return;}}
+if(data.comment&&data.comment.res&&data.comment.html){if(data.comment.id&&Y.one('#comment-'+data.comment.id)){Y.one('#comment-'+data.comment.id).replace(data.comment.html);}else{if(data.comment.parent&&data.comment['parent']>0){if(Y.one('#comm_wrap_'+data.comment['parent'])){Y.one('#comm_wrap_'+data.comment['parent']).replace(data.comment['html']);}}else{Y.one('#comm_wrap_'+data.comment.res).remove();Y.one('#comments-'+data.comment.res).insert(data.comment.html,Y.one('#comments-'+data.comment.res).one('.add_com'));}}
+return;}
+if(data.vote&&data.vote.hasOwnProperty('v')&&data.vote.rid){scoreDiv=Y.one('#score'+data.vote.rid);if(scoreDiv){scoreDiv.set('innerHTML',data.vote.v);}}else{if(data.redirect||data.answer){Y.StorageLite.removeItem(getStorageKey());removeTitle();removeTags();if(data.redirect){getAlerter('<h3>Success</h3>').set("bodyContent",'Item saved! Redirecting to <br><a href="'+data.redirect+'">'+data.redirect+'</a>').show();Y.later(1000,this,function(){window.location.assign(data.redirect);});}
+if(Y.one("#answers")){if(editor){editor.setEditorHTML('<br>');}
+Y.one("#answers").append(data.answer).scrollIntoView();if(typeof dp!=='undefined'){dp.SyntaxHighlighter.HighlightAll('code');}}}}},saveTitle=function(){var title=Y.one("#id_title");if(title){Y.StorageLite.setItem('title',title.get('value'));}},saveTags=function(){var tags=Y.one("#id_tags");if(tags){Y.StorageLite.setItem('tags',tags.get('value'));}},removeTitle=function(){var title=Y.one("#id_title");if(title){Y.StorageLite.removeItem('title');}},removeTags=function(){var tags=Y.one("#id_tags");if(tags){Y.StorageLite.removeItem('nuts');}},setFormError=function(o){var field,eErr;for(field in o){if(o.hasOwnProperty(field)){eErr=(Y.one("#"+field+"_e"));if(eErr){eErr.set('text',o[field]);}else{eErr=Y.one(".form_error");if(eErr){eErr.set('text',o[field]);}}
+if(eErr){eErr.scrollIntoView();}else{alert(o[field]);}}}},handleFailure=function(ioId,o){hideLoading();alert('Error occured. Server returned status '+o.status+' response: '+o.statusText);};Y.on('io:success',handleSuccess);Y.on('io:failure',handleFailure);MysubmitForm=function(e){var request,cfg,mbody,title,tags,reason,form=e.currentTarget;title=form.one("#id_title");tags=form.one("#id_tags");reason=form.one("#id_reason");if(reason&&(1>reason.get("value").length)){alert('You must include reason for editing');e.halt();return;}
+mbody=getEditedText();mbody=mbody.replace(/"codepreview"/g,'"code"');form.one("textarea[name=qbody]").set("value",mbody);cfg={method:'POST',form:{id:form,useDisabled:true}};if(Y.one("#dostuff")&&Y.one("#dostuff").ancestor('div')){showLoading(Y.one("#dostuff").ancestor('div'));}
+request=Y.io('/index.php',cfg);e.halt();return false;};var getYTbutton=function(){var ret={type:'separator'};if('1'==getMeta('btn_yt')){ret={type:'push',label:'Insert YouTube Video',value:'insertmedia',id:'btn_youtube'};}
+return ret;};var getCodeButton=function(){var ret={type:'separator'};if(typeof dp!=='undefined'){ret={group:'sourcecode',label:'Code style',buttons:[{type:'select',label:'Select',value:'codestyle',disabled:true,menu:[{text:'None',value:'nocode',checked:true},{text:'JavaScript',value:'javascript'},{text:'HTML/XML',value:'xml'},{text:'CSS',value:'css'},{text:'Python',value:'python'},{text:'Ruby',value:'ruby'},{text:'PHP',value:'php'},{text:'C',value:'c'},{text:'C++',value:'cpp'},{text:'C#',value:'csharp'},{text:'Java',value:'java'},{text:'SQL',value:'sql'},{text:'VB',value:'vb'},{text:'Delphi',value:'delphi'}]}]};}
+return ret;};var makeEditor=function(){var codeButtons,btnSeparator={type:'separator'};if(Y.one("#id_qbody")&&Y.all('.com_hand').isEmpty()){codeButtons=getCodeButton();editor=new YAHOO.widget.Editor('id_qbody',{dompath:false,width:'660px',height:'140px',autoHeight:true,extracss:'pre { margin-left: 10px; margin-right: 10px; padding: 2px; background-color: #EEE; } a.ytplay{position: absolute; display: block; height: 44px; width: 44px; top: 23px; left: 38px;} .yui-media { height: 90px; width: 120px; border: 1px solid black; background-color: #f2f2f2; background-image: url( "/images/media.gif" ); background-position: 45% 45%; background-repeat: no-repeat; } .ytvideo {border: 1px solid black; cursor: pointer; position: relative; clear: both; margin-bottom: 5px;}',animate:true,toolbar:{buttons:[{group:'saveclear',label:'Save / New',buttons:[{type:'push',label:'Save Draft',value:'save'},{type:'push',label:'New Document',value:'clear'}]},{group:'textstyle',label:'Font Style',buttons:[{type:'push',label:'Bold CTRL + SHIFT + B',value:'bold'},{type:'push',label:'Italic CTRL + SHIFT + I',value:'italic'},{type:'push',label:'Underline CTRL + SHIFT + U',value:'underline'},{type:'push',label:'Strike Through',value:'strikethrough'}]},btnSeparator,{group:'blockquote',label:'Quote',buttons:[{type:'push',label:'Indent',value:'indent',disabled:true},{type:'push',label:'Outdent',value:'outdent',disabled:true}]},btnSeparator,{group:'indentlist',label:'Lists',buttons:[{type:'push',label:'Create an Unordered List',value:'insertunorderedlist'},{type:'push',label:'Create an Ordered List',value:'insertorderedlist'}]},btnSeparator,codeButtons,btnSeparator,{group:'insertitem',label:'Link / Image',buttons:[{type:'push',label:'HTML Link CTRL + SHIFT + L',value:'createlink',disabled:true},{type:'push',label:'Insert Image',value:'insertimage',disabled:false},getYTbutton()]},btnSeparator,{group:'undoredo',label:'Undo/Redo',buttons:[{type:'push',label:'Undo',value:'undo',disabled:true},{type:'push',label:'Redo',value:'redo',disabled:true}]}]}});editor.filter_safari=function(html){if(this.browser.webkit){html=html.replace(/<span class="Apple-tab-span" style="white-space:pre">([^>])<\/span>/gi,'&nbsp;&nbsp;&nbsp;&nbsp;');html=html.replace(/Apple-style-span/gi,'');html=html.replace(/style="line-height: normal;"/gi,'');html=html.replace(/yui-wk-div/gi,'');html=html.replace(/yui-wk-p/gi,'');html=html.replace(/<li><\/li>/gi,'');html=html.replace(/<li> <\/li>/gi,'');html=html.replace(/<li> <\/li>/gi,'');if(this.get('ptags')){html=html.replace(/<div([^>]*)>/g,'<p$1>');html=html.replace(/<\/div>/gi,'</p>');}}
+return html;};editor.on('windowinsertmediaClose',function(){_handleWindowClose.call(this);},editor,true);editor.cmd_insertmedia=function(){this.execCommand('insertimage','');var el=this._swapEl(this.currentElement[0],'div',function(el){el.className='yui-media';YAHOO.util.Dom.setStyle(el,'fontSize','100px');});this.currentElement=[el];_handleMediaWindow.call(this);return[false];};editor.on('toolbarLoaded',function(){this.on('afterNodeChange',function(o){var ytbtn=this.toolbar.getButtonByValue('insertmedia'),btn=this.toolbar.getButtonByValue('codestyle');if(btn){if(this._hasSelection()){this.toolbar.enableButton(btn);}else{this.toolbar.disableButton(btn);}}
+if(ytbtn){if(this._hasSelection()){this.toolbar.disableButton('insertmedia');}else{this.toolbar.enableButton('insertmedia');var el=this._getSelectedElement();el=new Y.Node(el);if(el.hasClass('yui-media')){this.toolbar.selectButton('insertmedia');}else{this.toolbar.deselectButton('insertmedia');}}}
+preview();},this,true);editor.toolbar.on('insertmediaClick',function(){var el=editor._getSelectedElement();if(YAHOO.util.Dom.hasClass(el,'yui-media')){editor.currentElement=[el];_handleMediaWindow.call(editor);return false;}},this,true);this.on('editorKeyUp',function(){preview();});editor.toolbar.on('codestyleClick',function(ev){var escaped,html,sel=this._getSelection(),newEl,el=editor._getSelectedElement(),codetype=ev.button.value.toLowerCase();escaped=Y.Escape.html(sel.toString());switch(true){case('nocode'===codetype&&editor._isElement(el,'pre')):editor._swapEl(el,'code');html=editor.getEditorHTML();html=html.replace(/<code([^>]*)>/gi,'');html=html.replace(/<\/code>/gi,'');editor.setEditorHTML(html);break;case(editor._isElement(el,'pre')):el.className=codetype;break;default:editor.execCommand('inserthtml','<pre alt="codepreview" class="'+codetype+'">'+escaped+'</pre>');}
+return false;},this,true);editor.toolbar.on('clearClick',function(){if(confirm('Are you sure you want to reset the Editor?')){editor.setEditorHTML('<br>');write('Editor content cleared..');}});editor.toolbar.on('saveClick',saveToStorage);});editor.on('windowRender',function(){var body=document.createElement('div');body.innerHTML='<p>Paste Link to YouTube Video here:</p>';body.innerHTML+='<p>Click "Share" button on YouTube Video page<br>then copy the link from there and paste it into this form</p>';body.innerHTML+='<div id="media_control"><form>URL: <input id="embed_url" type="text" value="" size="30" style="font-size: 1.5em; padding: 2px;"></form></div>';body.innerHTML+='<br><div id="media_cont" class="fl cb" style="margin-left: 35px;"><button id="btn_addvideo" type="button" style="padding: 4px; font-size: 1em; cursor: pointer;">Add YouTube Video</button></div><br>';body.className='pad10';editor._windows.insertmedia={body:body};});if(!Y.one('#iedit')){Y.later(5000,editor,function(){if(editor.editorDirty){editor.editorDirty=null;saveToStorage();}},{},true);}
+Y.StorageLite.on('storage-lite:ready',function(){var title,tags,editorValue,body=Y.one('#id_qbody');editorValue=Y.StorageLite.getItem(getStorageKey());if(body&&!Y.one('#iedit')&&null!==editorValue&&''!==editorValue){body.set('value',editorValue);if(Y.one("#id_title")){title=Y.StorageLite.getItem('title');tags=Y.StorageLite.getItem('tags');if(title){Y.one("#id_title").set('value',title);}
+if(title){Y.one("#id_tags").set('value',tags);}}
+write('Loaded content draft from Local Storage');}else{write('Editor ready');}
+editor.render();});getEditedText=function(){var i,pre,holder,html=editor.getEditorHTML();html=editor.cleanHTML(html);if(typeof dp!=='undefined'){html=html.replace(/alt="codepreview"/g,'rel="codepreview"');holder=document.createElement('div');holder.innerHTML=html;pre=holder.getElementsByTagName('pre');for(i=0;i<pre.length;i++){pre[i].innerHTML="\n"+pre[i].innerHTML.replace(/<br>/g,"\n")+"\n";pre[i].innerHTML="\n"+pre[i].innerHTML.replace(/&nbsp;/g," ")+"\n";}
+html=holder.innerHTML;}
+return html;};previewDiv=Y.one('#tmp_preview');preview=function(){previewDiv=(previewDiv)?previewDiv:null;if(previewDiv){previewDiv.set('innerHTML',getEditedText());}
+if((typeof dp!=='undefined')&&dp.SyntaxHighlighter){dp.SyntaxHighlighter.HighlightAll('codepreview');}};}};showFlagForm=function(o){var oAlert,form,faction='flagger';if(ensureLogin()){if(o.rtype&&'c'===o.rtype){faction='flagcomment';}
+form='<div id="div_flag" style="text-align: left">'
++'<form name="form_flag" action="/index.php">'
++'<input type="hidden" name="a" value="'+faction+'">'
++'<input type="hidden" name="rid" value="{rid}">'
++'<input type="hidden" name="token" value="'+getToken()+'">'
++'<input type="hidden" name="qid" value="'+getMeta('qid')+'">'
++'<input type="hidden" name="rtype" value="{rtype}">'
++'<input type="radio" name="reason" value="spam"><label> Spam</label><br>'
++'<input type="radio" name="reason" value="inappropriate"><label> Inappropriate</label><br>'
++'<hr>'
++'<label for="id_note">Comments?</label>'
++'<textarea name="note" cols="40" rows="2" style="display: block;"></textarea>'
++'<input type="submit" class="btn" value="Report">'
++'</form>'
++'</div>';form=Y.Lang.sub(form,o);oAlert=getAlerter('<h3>Report to moderator</h3>');oAlert.set("bodyContent",form);oAlert.show();}};showCloseForm=function(qid){var oAlert,form;if(ensureLogin()){form='<div style="text-align: left">'
++'<form name="form_close" id="id_close" action="/index.php">'
++'<input type="hidden" name="a" value="close">'
++'<input type="hidden" name="token" value="'+getToken()+'">'
++'<input type="hidden" name="qid" value="'+qid+'">'
++'<input type="radio" name="reason" value="Not a question" checked><label>Not a real question</label><br>'
++'<input type="radio" name="reason" value="Off topic"><label>Way off Topic</label><br>'
++'<input type="radio" name="reason" value="Unproductive debate"><label>Turned into unproductive debate</label><br>'
++'<input type="radio" name="reason" value="Duplicate"><label>Duplicate question</label><br>'
++'<hr>'
++'<label for="id_note">Comments?</label>'
++'<textarea name="note" cols="40" rows="2" style="display: block;"></textarea>'
++'<input type="submit" class="btn" value="Close this question">'
++'</form>'
++'</div>';oAlert=getAlerter('<h3>Close this question</h3>');oAlert.set("bodyContent",form);oAlert.show();}};showRetagForm=function(){var oAlert,form,oTags,sTags='';if(ensureLogin()){oTags=Y.all('td.td_question > div.tgs a');oTags.each(function(){sTags+=this.get('text')+' ';});sTags=Y.Lang.trimRight(sTags);form='<div id="div_flag" style="text-align: left">'
++'<form name="form_flag" id="id_flag" action="/index.php">'
++'<input type="hidden" name="a" value="retag">'
++'<input type="hidden" name="token" value="'+getToken()+'">'
++'<input type="hidden" name="qid" value="'+getMeta('qid')+'">'
++'<hr>'
++'<label for="id_note">At least one tag, max 5 tags separated by spaces</label>'
++'<input type="text" class="ta1" id="id_retag" size="40" name="tags" value="'+sTags+'"></input>'
++'<br>'
++'<input type="submit" class="btn" value="Save">'
++'</form>'
++'</div>';oAlert=getAlerter('<h3>Edit Tags</h3>');oAlert.set("bodyContent",form);initTagInput(Y.one("#id_retag"));oAlert.show();}};var deleteComment=function(resID){var comment,f,myform,cfg,request;if(confirm('Really delete this comment?')){comment=Y.one("#comment-"+resID);if(comment){myform='<form name="form_del" action="/index.php">'
++'<input type="hidden" name="a" value="deletecomment">'
++'<input type="hidden" name="rid" value="'+resID+'">'
++'<input type="hidden" name="token" value="'+getToken()+'">';f=comment.appendChild(myform);cfg={method:'POST',form:{id:f,useDisabled:true}};request=Y.io('/index.php',cfg);comment.hide('fadeOut');Y.later(1000,comment,function(){comment.remove();});}}};showDeleteForm=function(o){var oAlert,form,banCheckbox='',a='delete';if(ensureLogin()){if(o.rtype&&'c'===o.rtype){a='deletecomment';}
+if(isModerator()){banCheckbox='<br><input type="checkbox" name="ban"><label> Ban poster</label><br>';}
+form='<div id="div_del" style="text-align: left">'
++'<form name="form_del" action="/index.php">'
++'<input type="hidden" name="a" value="'+a+'">'
++'<input type="hidden" name="rid" value="{rid}">'
++'<input type="hidden" name="token" value="'+getToken()+'">'
++'<input type="hidden" name="qid" value="'+getMeta('qid')+'">'
++'<input type="hidden" name="rtype" value="{rtype}">'
++'<hr>'
++'<label for="id_note">Reason for delete (optional)</label>'
++'<textarea name="note" cols="40" rows="2" style="display: block;"></textarea>'
++banCheckbox
++'<br><input type="submit" class="btn" value="Delete">'
++'</form>'
++'</div>';form=Y.Lang.sub(form,o);oAlert=getAlerter('<h3>Delete item</h3>');oAlert.set("bodyContent",form);oAlert.show();}};showCommentForm=function(el){var minrep,vid,form,rep,resID;rep=getReputation();vid=getViewerId();minrep=getMeta('min_com_rep');if(ensureLogin()){if(('1'===getMeta('comment'))||(getMeta('asker_id')==vid)||(rep>minrep)||el.test('.uid-'+vid)){resID=el.get('id');resID=resID.substr(8);form=Y.one('#add-comment-'+resID);if(!form){form=Y.Lang.sub(tplComform,{extraClass:'',divID:resID,resID:resID,formID:resID,token:getToken(),parentID:'0',comment:'comment',commentTip:commentTip});el.insert(form,'after');}else{if(form._isHidden()){form.show('fadeIn');}else{form.hide('fadeOut',null,function(o){});}}}else{alert('You must have a reputation of at least <b>'+minrep+'</b><br>'
++'to be able to add comments<br>'
++'Your current reputation is: <b>'+rep+'</b>');return;}}};showCommentReplyForm=function(el){var minrep,vid,form,rep,resID,parentDiv,parentID;rep=getReputation();vid=getViewerId();minrep=getMeta('min_com_rep');parentDiv=el.ancestor("div.com_wrap");resID=parentDiv.ancestor("div.comments").get('id');resID=resID.substr(9);if(ensureLogin()){if(('1'===getMeta('comment'))||(getMeta('asker_id')==vid)||(rep>minrep)||el.test('.uid-'+vid)){parentID=el.get('id');parentID=parentID.substr(8);form=Y.one('#comm_wrap_'+parentID);if(!form){form=Y.Lang.sub(tplComform,{extraClass:' com_wrap',divID:parentID,resID:resID,formID:parentID,token:getToken(),comment:'reply',commentTip:commentTip,parentID:parentID});parentDiv.insert(form,'after');}else{if(form._isHidden()){form.show('fadeIn');}else{form.hide('fadeOut');}}}else{alert('You must have a reputation of at least <b>'+minrep+'</b><br>'
++'to be able to add comments<br>'
++'Your current reputation is: <b>'+rep+'</b>');return;}}};showEditComment=function(resID){var form,wrapDiv,body,content;wrapDiv=Y.one("#comment-"+resID);if(wrapDiv){body=wrapDiv.one('.com_b');content=body.get('innerHTML');content=mmdDecode(content);form='<div id="comm_wrap_'+resID+'" class="fl cb">'
++'<form action="/index.php" id="edit-comment-'+resID+'" class="comform" method="post">'
++'<input type="hidden" name="a" value="editcomment">'
++'<input type="hidden" name="commentid" value="'+resID+'">'
++'<input type="hidden" name="token" value="'+getToken()+'">'
++'<table class="cb fr tbl_comment">'
++'<tr><td width="60px" class="com_icons" valign="top"></td>'
++'<td class="com_main">'
++'<textarea name="com_body" cols="60" rows="4" class="com_bo" style="display: block; padding: 2px;">'+content+'</textarea>'
++'</td>'
++'<td class="com_button" valign="top">'
++'<input type="submit" name="doit" class="btn_comment" value="save">'
++'</td>'
++'</tr>'
++commentTip
++'</table>'
++'</form></div>';wrapDiv.insert(form,'replace');}};showShredForm=function(uid){var id=uid.substr(5);form='<div id="div_del" style="text-align: left">'
++'<form name="form_shred" id="id_shred" action="/index.php">'
++'<input type="hidden" name="a" value="shred">'
++'<input type="hidden" name="uid" value="'+id+'">'
++'<input type="hidden" name="token" value="'+getToken()+'">'
++'<p>Shredding user will completely delete all posts made by the user<br>'
++'as well as all user tags'
++'<br>It will also change user status to *deleted*'
++'<br>and ban all IP addresses ever used by that user</p>'
++'<p>Proceed only if you absolutely sure you want to do this'
++'<hr>'
++'<input type="submit" class="btn_shred" value="Shred">'
++'</form>'
++'</div>';oAlert=getAlerter('<h3>Shred User</h3>');oAlert.set("bodyContent",form);oAlert.show();};setMeta=function(metaName,value){var node=getMeta(metaName,true);if(node&&value){node.set('content',value);}};ensureLogin=function(bForceAlert){var message;if(bForceAlert||!isLoggedIn()){message='<div class="larger"><p>You must login to perform this action</p>'
++'<p>Please login or <a class="close" href="#" onClick=oSL.getQuickRegForm(); return false;>Click here to register</a></div>';getAlerter('Please Login').set("bodyContent",message).show();return false;}
+return true;};getToken=function(){return getMeta('version_id');};setToken=function(val){setMeta('version_id',val);};getViewerId=function(){var uid;if(null===viewerId){uid=getMeta('session_uid');viewerId=(!uid)?0:parseInt(uid,10);}
+return viewerId;};isLoggedIn=function(){var ret,uid=getViewerId();ret=(uid&&(uid!=='')&&(uid!=='0'));return ret;};isModerator=function(){var role;if(bModerator<2){role=getMeta('role');if(role&&(('administrator'===role)||('moderator'===role))){bModerator=3;}else{bModerator=2;}}
+return(3===bModerator);};getReputation=function(){var score;if(!reputation){score=getMeta('rep');reputation=(!score)?1:parseInt(score,10);}
+return reputation;};addAdminControls=function(){var controls=Y.all('div.controls');if(controls){controls.each(function(){if(this.test('.question')){if(isModerator()||this.test('.uid-'+getViewerId())||(500<getReputation())){this.append(' <span class="ico retag ajax" title="Retag this item">retag</span>');}
+if(!Y.one('#closed')&&(isModerator()||this.test('.uid-'+getViewerId()))){this.append(' <span class="ico close ajax" title="Close this question">close</span>');}
+if('administrator'===getMeta('role')){if(!this.test('.sticky')){this.append(' <span class="ico stick ajax" title="Make sticky">stick</span>');}else{this.append(' <span title="Unstick" class="ico unstick ajax">unstick</span>');}}}
+if(isModerator()||this.test('.uid-'+getViewerId())||2000<getReputation()){if(isModerator()||this.test('.uid-'+getViewerId())){this.append(' <span title="Delete "class="ico del ajax">delete</span>');}
+if(!this.test('.com_tools')||isEditable(this)){this.append(' <span title="Edit" class="ico edit ajax">edit</span>');}}});}};isEditable=function(controls){var timeOfComment,timeDiff,maxDiff;if(isModerator()){return true;}
+maxDiff=getMeta('comments_timeout');if(!maxDiff){return true;}
+maxDiff=maxDiff*60000;timeOfComment=controls.one('div.com_ts').get('title');if(!timeOfComment){return true;}
+timeOfComment=new Date(timeOfComment);timeDiff=((new Date()).getTime()-timeOfComment.getTime());if(timeDiff>maxDiff){return false;}
+return true;};initFBSignup=function(){var callback,fbPerms;if(typeof FB!=='undefined'){fbPerms=getMeta('fbperms');if(!fbPerms){fbPerms='';}
+if(isLoggedIn()){callback=function(response){if(response.session){if(response.perms){showLoading(null,'Connecting<br>Facebook account');Y.io('/index.php?a=connectfb');}else{}}};}else{callback=function(response){if(response.session){if(response.perms){window.top.location.reload(true);}}else{}};}
+FB.login(callback,{perms:fbPerms});}
+return;};getAlerter=function(header){if(!oAlerter){oAlerter=new Y.Overlay({srcNode:'#fbOverlay',width:'500px',height:'300px',zIndex:100,centered:true,constrain:true,render:true,visible:false,plugins:[{fn:Y.Plugin.OverlayModal},{fn:Y.Plugin.OverlayKeepaligned}]});Y.one('#hide-fbOverlay').on('click',function(){oAlerter.hide();});}
+if(!header){header='Alert';}
+oAlerter.set("headerContent",'<h3>'+header+'</h3>');return oAlerter;};getMeta=function(metaName,asNode){var ret,node;if(!oMetas[metaName]){node=Y.one('meta[name='+metaName+']');oMetas[metaName]=node;}
+if(!oMetas[metaName]){return false;}
+if(asNode){return oMetas[metaName];}
+ret=oMetas[metaName].get('content');return ret;};checkExtApi=function(el){if((el.get('tagName')==='INPUT')&&el.get('checked')){saveToStorage();switch(true){case((el.get('id')==='api_tweet')&&(!getMeta('tw'))):Twitter.startDance();break;case((el.get('id')==='api_facebook')&&('1'!==getMeta('fb'))):initFBSignup();break;case((el.get('id')==='api_tumblr')&&('1'!==getMeta('tm'))):Twitter.startDance('/index.php?a=logintumblr',800,540);break;case((el.get('id')==='api_linkedin')&&('1'!==getMeta('linkedin'))):Twitter.startDance('/index.php?a=loginlinkedin',640,480);break;case((el.get('id')==='api_blogger')&&('1'!==getMeta('blgr'))):Twitter.startDance('/index.php?a=connectblogger',680,540);break;}}};revealComments=function(){var comments,limit=getMeta('max_com