From: <ki...@us...> - 2010-01-14 15:11:33
|
Revision: 452 http://xc-tokai.svn.sourceforge.net/xc-tokai/?rev=452&view=rev Author: kilica Date: 2010-01-14 15:11:26 +0000 (Thu, 14 Jan 2010) Log Message: ----------- update edit template Modified Paths: -------------- modules_xq/trunk/xoops_trust_path/modules/xq/actions/QueEditAction.class.php modules_xq/trunk/xoops_trust_path/modules/xq/actions/ReplyEditAction.class.php modules_xq/trunk/xoops_trust_path/modules/xq/class/AbstractEditAction.class.php modules_xq/trunk/xoops_trust_path/modules/xq/forms/AnsEditForm.class.php modules_xq/trunk/xoops_trust_path/modules/xq/forms/QueEditForm.class.php modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_ans_edit.html modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_edit.html modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_view.html modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_reply_edit.html Modified: modules_xq/trunk/xoops_trust_path/modules/xq/actions/QueEditAction.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/actions/QueEditAction.class.php 2010-01-13 23:26:38 UTC (rev 451) +++ modules_xq/trunk/xoops_trust_path/modules/xq/actions/QueEditAction.class.php 2010-01-14 15:11:26 UTC (rev 452) @@ -71,6 +71,13 @@ } } + /** + * hasPermission + * + * @param void + * + * @return bool + **/ public function hasPermission() { if($this->mObject->get('cat_id')==0 && $this->mObject->isNew()){ @@ -79,6 +86,7 @@ parent::hasPermission(); } + /** * prepare * Modified: modules_xq/trunk/xoops_trust_path/modules/xq/actions/ReplyEditAction.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/actions/ReplyEditAction.class.php 2010-01-13 23:26:38 UTC (rev 451) +++ modules_xq/trunk/xoops_trust_path/modules/xq/actions/ReplyEditAction.class.php 2010-01-14 15:11:26 UTC (rev 452) @@ -75,7 +75,7 @@ **/ public function prepare() { - prepare::parent(); + parent::prepare(); $this->mObject->loadQue(); return true; @@ -90,19 +90,19 @@ **/ protected function _setupActionForm() { - $this->mActionForm =& $this->mAsset->getObject('form', 'Ans',false,'edit'); - $this->mActionForm->prepare(); + $this->mActionForm =& $this->mAsset->getObject('form', 'Reply',false,'edit'); + $this->mActionForm->prepare($this->mAsset->mDirname); } public function hasPermission() { $module =""; ///TODO: now dummy - $this->mObject->loadQue($this->mAsset->mDirname); + $this->mObject->loadQue(); if($this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser')){ //is Editor ? $action = $this->_getXqAuthType('edit'); - XCube_DelegateUitls::call('Legacy_Category.CheckPermitByUserId', XCube_Ref($check), $this->mQue->get('cat_id'), $action, Xq_Utils::getUid(), $module); + XCube_DelegateUtils::call('Legacy_Category.CheckPermitByUserId', new XCube_Ref($check), $this->mObject->mQue->get('cat_id'), $action, Xq_Utils::getUid(), $module); if($check==true){ return true; } @@ -115,7 +115,7 @@ } else{ //password check ok ? - if($this->mObject->mQue->get('password') && $this->mObject->get('password')==$this->mRoot->mContext->mRequest->getRequest('password')){ + if($this->mObject->mQue->get('uid')==0){ return true; } } Modified: modules_xq/trunk/xoops_trust_path/modules/xq/class/AbstractEditAction.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/class/AbstractEditAction.class.php 2010-01-13 23:26:38 UTC (rev 451) +++ modules_xq/trunk/xoops_trust_path/modules/xq/class/AbstractEditAction.class.php 2010-01-14 15:11:26 UTC (rev 452) @@ -87,27 +87,25 @@ $catId = $this->_getCatId(); $module = ""; ///TODO: now dummy - if($this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser')){ - //is Editor ? - $action = $this->_getXqAuthType('edit'); - XCube_DelegateUtils::call('Legacy_Category.CheckPermitByUserId', new XCube_Ref($check), $catId, $action, Xq_Utils::getUid(), $module); - if($check==true){ + //is Editor ? + $action = $this->_getXqAuthType('edit'); + XCube_DelegateUtils::call('Legacy_Category.CheckPermitByUserId', new XCube_Ref($check), $catId, $action, Xq_Utils::getUid(), $module); + if($check==true){ + return true; + } + //is new post and has post permission ? + XCube_DelegateUtils::call('Legacy_Category.CheckPermitByUserId', new XCube_Ref($check), $catId, $this->getAuthType(), Xq_Utils::getUid(), $module); + if($check==true && $this->mObject->isNew()){ + return true; + } + + //is old post and your post ? + XCube_DelegateUtils::call('Legacy_Category.CheckPermitByUserId', new XCube_Ref($check), $catId, $this->getAuthType(), Xq_Utils::getUid(), $module); + if($check==true && ! $this->mObject->isNew() && $this->mObject->get('uid')==Xq_Utils::getUid()){ return true; - } - - //is new post and has post permission ? - XCube_DelegateUtils::call('Legacy_Category.CheckPermitByUserId', new XCube_Ref($check), $catId, $this->getAuthType(), Xq_Utils::getUid(), $module); - if($check==true && $this->mObject->isNew()){ - return true; - } - - //is old post and your post ? - XCube_DelegateUtils::call('Legacy_Category.CheckPermitByUserId', new XCube_Ref($check), $catId, $this->getAuthType(), Xq_Utils::getUid(), $module); - if($check==true && ! $this->mObject->isNew() && $this->mObject->get('uid')==Xq_Utils::getUid()){ - return true; - } - } - else{ + } + + if(! $this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser')){ //password check ok ? if($this->mObject->get('password') && $this->mObject->get('password')==$this->mRoot->mContext->mRequest->getRequest('password')){ return true; Modified: modules_xq/trunk/xoops_trust_path/modules/xq/forms/AnsEditForm.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/forms/AnsEditForm.class.php 2010-01-13 23:26:38 UTC (rev 451) +++ modules_xq/trunk/xoops_trust_path/modules/xq/forms/AnsEditForm.class.php 2010-01-14 15:11:26 UTC (rev 452) @@ -41,7 +41,7 @@ * * @return void **/ - public function prepare() + public function prepare($dirname) { $this->_mDirname = $dirname; // @@ -138,7 +138,9 @@ $obj->set('que_id', $this->get('que_id')); //$obj->set('uid', $this->get('uid')); $obj->set('name', $this->get('name')); - $obj->set('password', $this->get('password')); + if($obj->isNew()){ + $obj->set('password', $this->get('password')); + } $obj->set('exp', $this->get('exp')); $obj->set('answer', $this->get('answer')); $obj->set('rating', $this->get('rating')); @@ -158,8 +160,12 @@ { if(XCube_Root::getSingleton()->mContext->mUser->isInRole('Site.RegisteredUser')){ $authType = new Xq_AuthType($this->_mDirname); + if($this->get('ans_id')>0){ + $ans = Xq_Utils::getXqHandler('ans', $this->_mDirname)->get($this->get('ans_id')); + $ans->loadQue(); + } //is Editor ? - XCube_DelegateUtils::call('Legacy_Category.CheckPermitByUserId', new XCube_Ref($check), $this->get('cat_id'), $authType->getAuthType('edit'), Xq_Utils::getUid(), $module); + XCube_DelegateUtils::call('Legacy_Category.CheckPermitByUserId', new XCube_Ref($check), $ans->mQue->getShow('cat_id'), $authType->getAuthType('edit'), Xq_Utils::getUid()); if($check==true){ return; } Modified: modules_xq/trunk/xoops_trust_path/modules/xq/forms/QueEditForm.class.php =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/forms/QueEditForm.class.php 2010-01-13 23:26:38 UTC (rev 451) +++ modules_xq/trunk/xoops_trust_path/modules/xq/forms/QueEditForm.class.php 2010-01-14 15:11:26 UTC (rev 452) @@ -138,7 +138,9 @@ $obj->set('cat_id', $this->get('cat_id')); //$obj->set('uid', $this->get('uid')); $obj->set('name', $this->get('name')); - $obj->set('password', $this->get('password')); + if($obj->isNew()){ + $obj->set('password', $this->get('password')); + } $obj->set('email', $this->get('email')); $obj->set('exp', $this->get('exp')); $obj->set('question', $this->get('question')); Modified: modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_ans_edit.html =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_ans_edit.html 2010-01-13 23:26:38 UTC (rev 451) +++ modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_ans_edit.html 2010-01-14 15:11:26 UTC (rev 452) @@ -44,53 +44,46 @@ <{xoops_input type=hidden name=ans_id value=$actionForm->get('ans_id')}> <{xoops_input type=hidden name=que_id value=$actionForm->get('que_id')}> <{xoops_input type=hidden name=rating value=$actionForm->get('rating')}> - <table class="outer"> - <tr> - <{if $actionForm->get('ans_id')}> - <th colspan="2"><img src="images/icon_a.gif" alt="A" /> <{$smarty.const._MD_XQ_LANG_ANS_EDIT}></th> - <{else}> - <th colspan="2"><img src="images/icon_a.gif" alt="A" /> <{$smarty.const._MD_XQ_LANG_ADD_A_NEW_ANS}></th> - <{/if}> - </tr> - <tr> - <td class="head"><{$smarty.const._MD_XQ_LANG_TITLE}></td> - <td class="<{cycle values="odd,even"}>"> - <{xoops_input type=text name=title value=$actionForm->get('title') size=50 maxlength=255}> - </td> - </tr> - <{if ! $actionForm->get('uid')}> - <tr> - <td class="head"><{$smarty.const._MD_XQ_LANG_NAME}></td> - <td class="<{cycle values="odd,even"}>"> - <{xoops_input type=text name=name value=$actionForm->get('name') size=15 maxlength=16}> - </td> - </tr> - <tr> - <td class="head"><{$smarty.const._MD_XQ_LANG_PASSWORD}></td> - <td class="<{cycle values="odd,even"}>"> - <{xoops_input type=password name=password value="" size=15 maxlength=8}> - </td> - </tr> - <{/if}> - <tr> - <td class="head"><{$smarty.const._MD_XQ_LANG_A_LABEL}></td> - <td class="<{cycle values="odd,even"}>"> - <{foreach item=exp from=$expList key=k}> - <label><input type="radio" name="exp" value="<{$k}>"<{if $k==$actionForm->get('exp')}> checked="checked"<{/if}> /><{$exp}></label> - <{/foreach}> - </td> - </tr> - <tr> - <td class="head"><{$smarty.const._MD_XQ_LANG_ANSWER}></td> - <td class="<{cycle values="odd,even"}>"> - <{xoops_textarea type=text name=answer value=$actionForm->get('answer') rows=15 cols=60}> - </td> - </tr> - <tr> - <td class="foot" colspan="2"> - <input type="submit" class="formButton" value="<{$smarty.const._SUBMIT}>"/> - </td> - </tr> - </table> + <dl> + <dt><{$smarty.const._MD_XQ_LANG_TITLE}></dt> + <dd> + <{xoops_input type=text name=title value=$actionForm->get('title') size=50 maxlength=255}> + </dd> + <{if $object->isNew()}> + <{if ! $xoops_isuser}> + <dt><{$smarty.const._MD_XQ_LANG_NAME}></dt> + <dd> + <{xoops_input type=text name=name value=$actionForm->get('name') size=15 maxlength=64}> + </dd> + <dt><{$smarty.const._MD_XQ_LANG_PASSWORD}></dt> + <dd> + <{xoops_input type=text name=password value="" size=15 maxlength=8}> + </dd> + <{/if}> + <{else}> + <{if $object->get('name')}> + <dt><{$smarty.const._MD_XQ_LANG_PASSWORD}></dt> + <dd> + <{xoops_input type=hidden name=name value=$actionForm->get('name')}> + <{if ! $xoops_isuser}> + <{xoops_input type=text name=password value="" size=15 maxlength=8}> + <{/if}> + </dd> + <{/if}> + <{/if}> + <dt><{$smarty.const._MD_XQ_LANG_A_LABEL}></dt> + <dd> + <{foreach item=exp from=$expList key=k}> + <label><input type="radio" name="exp" value="<{$k}>"<{if $k==$actionForm->get('exp')}> checked="checked"<{/if}> /><{$exp}></label> + <{/foreach}> + </dt> + <dt><{$smarty.const._MD_XQ_LANG_ANSWER}></dt> + <dd> + <{xoops_textarea type=text name=answer value=$actionForm->get('answer') rows=15 cols=60}> + </dd> + <dd> + <input type="submit" class="formButton" value="<{$smarty.const._SUBMIT}>"/> + </dd> + </dl> </form> </div> \ No newline at end of file Modified: modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_edit.html =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_edit.html 2010-01-13 23:26:38 UTC (rev 451) +++ modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_edit.html 2010-01-14 15:11:26 UTC (rev 452) @@ -17,22 +17,28 @@ <{xoops_category_select tree=$catArr selectedValue=$object->get('cat_id')}> </select> </dd> - <dt><{$smarty.const._MD_XQ_LANG_NAME}></dt> - <{if ! $xoops_isuser}> - <{if ! $actionForm->get('name')}> + <{if $object->isNew()}> + <{if ! $xoops_isuser}> + <dt><{$smarty.const._MD_XQ_LANG_NAME}></dt> <dd> <{xoops_input type=text name=name value=$actionForm->get('name') size=15 maxlength=64}> </dd> - <{else}> - <{xoops_input type=hidden name=name value=$actionForm->get('name')}> + <dt><{$smarty.const._MD_XQ_LANG_PASSWORD}></dt> + <dd> + <{xoops_input type=text name=password value="" size=15 maxlength=8}> + </dd> <{/if}> + <{else}> + <{if $object->get('name')}> + <dd> + <dt><{$smarty.const._MD_XQ_LANG_PASSWORD}></dt> + <{xoops_input type=hidden name=name value=$actionForm->get('name')}> + <{if ! $xoops_isuser}> + <{xoops_input type=text name=password value="" size=15 maxlength=8}> + <{/if}> + </dd> + <{/if}> <{/if}> - <{if ! $xoops_isuser}> - <dt><{$smarty.const._MD_XQ_LANG_PASSWORD}></dt> - <dd> - <{xoops_input type=text name=password value="" size=15 maxlength=8}> - </dd> - <{/if}> <dt><{$smarty.const._MD_XQ_LANG_EXP}></dt> <dd> <{foreach item=exp from=$expList key=k}> Modified: modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_view.html =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_view.html 2010-01-13 23:26:38 UTC (rev 451) +++ modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_que_view.html 2010-01-14 15:11:26 UTC (rev 452) @@ -84,7 +84,7 @@ <{$answer->getShowRating()}> <{$answer->get('cmt_unixtime')|xoops_formattimestamp:l}> <{if $object->getShow('uid')==0 || $object->getShow('uid')==$xoops_userid}> - <a href="./index.php?action=AnsEdit&ans_id=<{$answer->getShow('ans_id')}>&mode=cmt"><img src="images/comment.gif" alt="<{$smarty.const._MD_XQ_LANG_COMMENT_TO_ANSWER}>" /></a> + <a href="./index.php?action=ReplyEdit&ans_id=<{$answer->getShow('ans_id')}>"><img src="images/comment.gif" alt="<{$smarty.const._MD_XQ_LANG_COMMENT_TO_ANSWER}>" /></a> <{/if}> </h4> <p> Modified: modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_reply_edit.html =================================================================== --- modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_reply_edit.html 2010-01-13 23:26:38 UTC (rev 451) +++ modules_xq/trunk/xoops_trust_path/modules/xq/templates/xq_reply_edit.html 2010-01-14 15:11:26 UTC (rev 452) @@ -5,12 +5,20 @@ <{/foreach}> </ul> <{/if}> -<form action="index.php?action=AnsEdit" method="post"> +<form action="index.php?action=ReplyEdit" method="post"> <dl> <dt><{$smarty.const._MD_XQ_LANG_RATING}></dt> <dd> <{xoops_input type=text name=rating value=$actionForm->get('rating')}> </dd> + <{if $object->mQue->get('name')}> + <dd> + <dt><{$smarty.const._MD_XQ_LANG_PASSWORD}></dt> + <{if ! $xoops_isuser}> + <{xoops_input type=text name=password value="" size=15 maxlength=8}> + <{/if}> + </dd> + <{/if}> <dt><{$smarty.const._MD_XQ_LANG_COMMENT}></dt> <dd> <{xoops_textarea type=text name=comment value=$actionForm->get('comment')}> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |