From: <ki...@us...> - 2008-12-13 03:16:14
|
Revision: 368 http://xc-tokai.svn.sourceforge.net/xc-tokai/?rev=368&view=rev Author: kilica Date: 2008-12-13 03:16:10 +0000 (Sat, 13 Dec 2008) Log Message: ----------- [0.12] BugFix: choice_id field type in poll table [0.12] Google Chart API Modified Paths: -------------- modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/README.txt modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/actions/EnqRssAction.class.php modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/actions/EnqViewAction.class.php modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/actions/PollDetailAction.class.php modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/class/handler/Choice.class.php modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/forms/PollEditForm.class.php modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/sql/mysql.sql modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/templates/bizpoll_enq_view.html modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/templates/bizpoll_poll_detail.html Modified: modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/README.txt =================================================================== --- modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/README.txt 2008-12-12 10:45:10 UTC (rev 367) +++ modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/README.txt 2008-12-13 03:16:10 UTC (rev 368) @@ -18,6 +18,11 @@ \x8DX\x90V\x97\x9A\x97\xF0 -------- +0.12(2008.12.11) +\x81\xA60.11\x88ȑO\x82̃o\x81[\x83W\x83\x87\x83\x93\x82\xF0\x8Eg\x82\xED\x82\xEA\x82Ă\xA2\x82\xE9\x8Fꍇ\x82́AMySQL \x82̃e\x81[\x83u\x83\x8B\x82\xCC bizpoll_poll \x82\xCC "choice_id" \x82\xCC type \x82\xF0 text \x82ɕύX\x82\xB5\x82Ă\xAD\x82\xBE\x82\xB3\x82\xA2\x81B +\x81EChoice \x82̍ĕҏW\x8B@\x94\\x82\xF0\x92lj\xC1 +\x81E\x95\xA1\x90\x94\x89̏ꍇ\x82̃o\x83O\x82\xF0\x8FC\x90\xB3\x81B + 0.11(2008.12.08) \x81ERSS\x92lj\xC1 Modified: modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/actions/EnqRssAction.class.php =================================================================== --- modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/actions/EnqRssAction.class.php 2008-12-12 10:45:10 UTC (rev 367) +++ modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/actions/EnqRssAction.class.php 2008-12-13 03:16:10 UTC (rev 368) @@ -89,8 +89,8 @@ foreach(array_keys($this->mObjects) as $key) { $enqRssArr['title'][$key] = $this->mObjects[$key]->getShow('title'); - $enqRssArr['link'][$key] = XOOPS_URL. '/modules/'. $this->mAsset->mDirname .'/index.php?action=EnqList&enq_id='. $this->mObjects[$key]->getShow('enq_id'); - $enqRssArr['guid'][$key] = XOOPS_URL. '/modules/'. $this->mAsset->mDirname .'/index.php?action=EnqList&enq_id='. $this->mObjects[$key]->getShow('enq_id'); + $enqRssArr['link'][$key] = XOOPS_URL. '/modules/'. $this->mAsset->mDirname .'/index.php?action=EnqView&enq_id='. $this->mObjects[$key]->getShow('enq_id'); + $enqRssArr['guid'][$key] = XOOPS_URL. '/modules/'. $this->mAsset->mDirname .'/index.php?action=EnqView&enq_id='. $this->mObjects[$key]->getShow('enq_id'); $enqRssArr['pubDate'][$key] = $this->mObjects[$key]->getShow('pub_unixtime'); if($this->mObjects[$key]->getShow('uid')>0){ $user = $userHandler->getUser($this->mObjects[$key]->getShow('uid')); Modified: modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/actions/EnqViewAction.class.php =================================================================== --- modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/actions/EnqViewAction.class.php 2008-12-12 10:45:10 UTC (rev 367) +++ modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/actions/EnqViewAction.class.php 2008-12-13 03:16:10 UTC (rev 368) @@ -109,6 +109,7 @@ foreach(array_keys($this->mObject->mChoice) as $key){ $this->mObject->mChoice[$key]->loadPolled($this->mAsset->mDirname); $this->mObject->mChoice[$key]->countPoll($this->mAsset->mDirname); + $this->mObject->mChoice[$key]->checkEditor($this->mAsset->mDirname); } //load Poll of this User Modified: modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/actions/PollDetailAction.class.php =================================================================== --- modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/actions/PollDetailAction.class.php 2008-12-12 10:45:10 UTC (rev 367) +++ modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/actions/PollDetailAction.class.php 2008-12-13 03:16:10 UTC (rev 368) @@ -19,6 +19,7 @@ class Bizpoll_PollDetailAction extends Bizpoll_AbstractListAction { var $mEnq = null; + var $mChart = array(); /** * _getId @@ -109,9 +110,19 @@ $this->mObjects =& $handler->getObjects($criteria); //loadChoice + $this->mChart['count'] = array(); + $this->mChart['title'] = array(); + $this->mChart['total'] = array(); foreach(array_keys($this->mObjects) as $key){ $this->mObjects[$key]->loadChoice($this->mAsset->mDirname); + //for Google Chart API + $choiceArr = explode(',', $this->mObjects[$key]->get('choice_id')); + foreach(array_keys($choiceArr) as $keyC){ + $this->mChart['count'][$choiceArr[$keyC]]++; + $this->mChart['title'][$choiceArr[$keyC]] = '('. $this->mChart['count'][$choiceArr[$keyC]] .')+'. strtr($this->mObjects[$key]->mChoice[$keyC]->getShow('title'), ' ', '+'); + } } + $this->mChart['total'] = count($this->mChart['title']); return BIZPOLL_FRAME_VIEW_INDEX; } @@ -126,6 +137,7 @@ $render->setTemplateName($this->mAsset->mDirname . '_poll_detail.html'); $render->setAttribute('objects', $this->mObjects); $render->setAttribute('enq', $this->mEnq); + $render->setAttribute('chart', $this->mChart); $render->setAttribute('pageNavi', $this->mFilter->mNavi); } } Modified: modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/class/handler/Choice.class.php =================================================================== --- modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/class/handler/Choice.class.php 2008-12-12 10:45:10 UTC (rev 367) +++ modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/class/handler/Choice.class.php 2008-12-13 03:16:10 UTC (rev 368) @@ -9,6 +9,7 @@ { exit; } +require_once BIZPOLL_TRUST_PATH . '/class/XcatHandler.class.php'; /** * Bizpoll_ChoiceObject @@ -22,6 +23,7 @@ var $mPollCount = 0; var $_mPollCountFlag = false; var $mIsPolled = false; + var $mAllowEdit = false; /** * __construct @@ -71,7 +73,7 @@ } elseif($this->mEnq->get('type')==1){ //checkbox $pollArr = & $handler->getObjects(new Criteria('enq_id', $this->get('enq_id'))); - foreach(array_keys($choiceArr) as $key){ + foreach(array_keys($pollArr) as $key){ $choices = explode(',', $pollArr[$key]->get('choice_id')); if(in_array($this->get('choice_id'), $choices)){ $this->mPoll[] = $pollArr[$key]; @@ -114,6 +116,28 @@ } } + public function checkEditor($dirname) + { + $root = XCube_Root::getSingleton(); + $this->loadEnq($dirname); + if(! $root->mContext->mXoopsUser){ + return; + } + + //this user added this choice ? + if($this->get('uid')==$root->mContext->mXoopsUser->get('uid')){ + $this->mAllowEdit = true; + } + //this user added this enq ? + //this user has Editor Permission + else{ + $xcatHandler = new Bizpoll_XcatHandler($dirname); + if($xcatHandler->checkPermit($this->mEnq->get('cat_id'), 'editor', $this->mEnq->get('uid'))==true){ + $this->mAllowEdit = true; + } + } + } + protected function &_getHandler($dirname, $tablename) { $asset = null; Modified: modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/forms/PollEditForm.class.php =================================================================== --- modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/forms/PollEditForm.class.php 2008-12-12 10:45:10 UTC (rev 367) +++ modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/forms/PollEditForm.class.php 2008-12-13 03:16:10 UTC (rev 368) @@ -47,7 +47,7 @@ $this->mFormProperties['enq_id'] =& new XCube_IntProperty('enq_id'); $this->mFormProperties['uid'] =& new XCube_IntProperty('uid'); $this->mFormProperties['name'] =& new XCube_StringProperty('name'); - $this->mFormProperties['choice_id'] =& new XCube_IntProperty('choice_id'); + $this->mFormProperties['choice_id'] =& new XCube_TextProperty('choice_id'); $this->mFormProperties['ip'] =& new XCube_StringProperty('ip'); $this->mFormProperties['comment'] =& new XCube_TextProperty('comment'); $this->mFormProperties['reg_unixtime'] =& new XCube_IntProperty('reg_unixtime'); Modified: modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/sql/mysql.sql =================================================================== --- modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/sql/mysql.sql 2008-12-12 10:45:10 UTC (rev 367) +++ modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/sql/mysql.sql 2008-12-13 03:16:10 UTC (rev 368) @@ -29,7 +29,7 @@ `enq_id` mediumint(8) unsigned NOT NULL, `uid` mediumint(8) unsigned NOT NULL, `name` varchar(32) NOT NULL, - `choice_id` int(11) unsigned NOT NULL, + `choice_id` text NOT NULL, `ip` varchar(255) NOT NULL, `comment` text NOT NULL, `reg_unixtime` int(11) unsigned NOT NULL, Modified: modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/templates/bizpoll_enq_view.html =================================================================== --- modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/templates/bizpoll_enq_view.html 2008-12-12 10:45:10 UTC (rev 367) +++ modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/templates/bizpoll_enq_view.html 2008-12-13 03:16:10 UTC (rev 368) @@ -73,6 +73,9 @@ <dt><label> <input type="radio" name="choice_id" id="legacy_xoopsform_choice_id" value="<{$choiceR->getShow('choice_id')}>"<{if $choiceR->mIsPolled==true}> checked="checked"<{/if}>> <{$choiceR->getShow('title')}><{if $allowShowResult==true}> (<{$smarty.const._MD_BIZPOLL_LANG_POLL_COUNT}>: <{$choiceR->mPollCount}>)<{/if}></label> + <{if $choiceR->mAllowEdit==true}> + <a href="./index.php?action=ChoiceEdit&choice_id=<{$choiceR->getShow('choice_id')}>"><img src="<{$xoops_url}>/images/icons/edit.gif" alt="<{$smarty.const._EDIT}>" /></a> + <{/if}> </dt> <dd><{$choiceR->getShow('description')}></dd> <{/foreach}> Modified: modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/templates/bizpoll_poll_detail.html =================================================================== --- modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/templates/bizpoll_poll_detail.html 2008-12-12 10:45:10 UTC (rev 367) +++ modules_bizpoll/trunk/xoops_trust_path/modules/bizpoll/templates/bizpoll_poll_detail.html 2008-12-13 03:16:10 UTC (rev 368) @@ -1,6 +1,8 @@ <div class="bizpoll"> <h1><{$enq->getShow('title')}></h1> +<img src="http://chart.apis.google.com/chart?chs=400x<{$chart.total*35}>&chd=t:<{foreach item=pCount from=$chart.count name=pCount}><{$pCount}><{if ! $smarty.foreach.pCount.last}>,<{/if}><{/foreach}>&cht=bhg&chm=<{foreach item=pTitle from=$chart.title name=pTitle}>t<{$pTitle}>,000000,<{$smarty.foreach.pTitle.iteration-1}>,0,13<{if ! $smarty.foreach.pTitle.last}>|<{/if}><{/foreach}>" alt="result graph"> + <div class="pagenavi"><{xoops_pagenavi pagenavi=$pageNavi}></div> <hr /> <dl> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |