当前位置: 首页>>代码示例>>C++>>正文


C++ CUser::GetIsEditor方法代码示例

本文整理汇总了C++中CUser::GetIsEditor方法的典型用法代码示例。如果您正苦于以下问题:C++ CUser::GetIsEditor方法的具体用法?C++ CUser::GetIsEditor怎么用?C++ CUser::GetIsEditor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CUser的用法示例。


在下文中一共展示了CUser::GetIsEditor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Build

bool CModeratePostsBuilder::Build(CWholePage* pWholePage)
{
	InitPage(pWholePage, "POST-MODERATION", true);
	bool bSuccess = true;

	// do an error page if not an editor or moderator.
	CUser* pViewer = m_InputContext.GetCurrentUser();
	if (pViewer == NULL || !(pViewer->GetIsEditor() || pViewer->GetIsModerator()) )
	{
		bSuccess = bSuccess && pWholePage->SetPageType("ERROR");
		bSuccess = bSuccess && pWholePage->AddInside("H2G2", "<ERROR TYPE='NOT-EDITOR'>You cannot perform moderation unless you are logged in as an Editor or Moderator.</ERROR>");
		return true;
	}

	//Process Actions.
	if ( ! Process(pWholePage,pViewer) )
	{
		SetDNALastError("CModeratePostsBuilder::Build","Build","Unable to process");
		pWholePage->AddInside("H2G2",GetLastErrorAsXMLString());
	}

	//Handle s_returnto.
	if ( bSuccess && CheckAndUseRedirectIfGiven(pWholePage) )
		return bSuccess;

	//Handle 'Oldstyle' redirect - necessary to handle multiple submit buttons for the same form.  
	if ( m_InputContext.ParamExists("Done") )
	{
		CTDVString sRedirect = "Moderate?newstyle=1";
		if ( m_InputContext.GetParamInt("fastmod") == 1 )
			sRedirect += "&fastmod=1";
		return pWholePage->Redirect(sRedirect);
	}

	//Produce XML for page.

	// find out if we are processing referrals or not
	bool bReferrals = m_InputContext.GetParamInt("Referrals") == 1;
	bool bAlerts = m_InputContext.GetParamInt("Alerts") == 1;
	bool bLockedItems = m_InputContext.GetParamInt("Locked") == 1; //Viewing users locked items only.
	bool bHeldItems = m_InputContext.GetParamInt("Held") == 1;
	int iShow = 10;
	if ( m_InputContext.ParamExists("show") )
		iShow = m_InputContext.GetParamInt("show");
	
	bool bFastMod = m_InputContext.GetParamInt("fastmod") != 0;

	int iModClassId = 0;
	if ( m_InputContext.ParamExists("ModClassId") )
		iModClassId = m_InputContext.GetParamInt("ModClassId");

	//Filter on moderation items for a specific post.
	int iPostId = 0;
	if ( m_InputContext.ParamExists("PostFilterId") )
		iPostId = m_InputContext.GetParamInt("PostFilterId");

	//Add Moderation Classes
	CModerationClasses modclasses(m_InputContext);
	if ( modclasses.GetModerationClasses() )
		bSuccess = bSuccess && pWholePage->AddInside("H2G2",&modclasses);
	else if ( modclasses.ErrorReported() )
		bSuccess && bSuccess && pWholePage->AddInside("H2G2",modclasses.GetLastErrorAsXMLString() );

	//Add Moderation Failure - Reasons
	CModReasons reasons(m_InputContext);
	if ( reasons.GetModReasons(iModClassId) )
		bSuccess = bSuccess && pWholePage->AddInside("H2G2",&reasons);

	//Add Refereee List
	CRefereeList referees(m_InputContext);
	if ( referees.FetchTheList() )
		bSuccess = bSuccess && pWholePage->AddInside("H2G2",&referees);

	//Add Site List
	//CTDVString sSiteXML;
	//bSuccess = bSuccess && m_InputContext.GetSiteListAsXML(&sSiteXML, 2);
	//bSuccess = bSuccess && pWholePage->AddInside("H2G2", sSiteXML);
	CBasicSiteList sitelist(m_InputContext);
	if ( !sitelist.PopulateList() )
		pWholePage->AddInside("H2G2",sitelist.GetLastErrorAsXMLString());
	else
		bSuccess = bSuccess && pWholePage->AddInside("H2G2",sitelist.GetAsXML2());

	//Add User Moderation Statuses
	CUserStatuses modstatuses(m_InputContext);
	if ( modstatuses.GetUserStatuses() )
		pWholePage->AddInside("H2G2",&modstatuses);
	else if ( modstatuses.ErrorReported() )
		pWholePage->AddInside("H2G2",modstatuses.GetLastErrorAsXMLString());

	//Add Distress Messages
	CModerationDistressMessages distressmsgs(m_InputContext);
	if ( distressmsgs.GetDistressMessages(iModClassId) )
		pWholePage->AddInside("H2G2",&distressmsgs);
	else
		pWholePage->AddInside("H2G2",distressmsgs.GetLastErrorAsXMLString() );


	CModeratePosts moderate(m_InputContext);
	if ( !moderate.GetPosts( pViewer->GetUserID(), bAlerts, bReferrals, bLockedItems, bHeldItems, iModClassId, iPostId,  iShow, bFastMod ) )
//.........这里部分代码省略.........
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:ModeratePosts.cpp

示例2: RemoveThreadFromForum

bool CReviewSubmissionForum::RemoveThreadFromForum(CUser& mViewer,int iReviewForumID,int iH2G2ID, int* iThreadID,int* iForumID,bool *pbSuccessful,bool bHasPermission /*false*/)
{
	if (iReviewForumID <= 0 || iH2G2ID <= 0)
	{
		TDVASSERT(false,"Bad ReviewForum ID in CReviewSubmissionForum::RemoveThreadFromForum");
		
		*pbSuccessful = false;
		
		return GracefulError("SUBMIT-REVIEW-FORUM","RMBADID","Bad arguments for this action");
	}
	
	//Initialise the article
	
	CGuideEntry mGuideEntry(m_InputContext);
	
	if (!mGuideEntry.Initialise(iH2G2ID,0, false,true,false,false,false))
	{
		
		*pbSuccessful = false;
		
		return GracefulError("SUBMIT-REVIEW-FORUM","NOARTICLE","Failed to Get Article details");
	}
	
	//create a storedprocedure 
	
	CStoredProcedure mSP;
	if (!m_InputContext.InitialiseStoredProcedureObject(&mSP))
	{
		
		*pbSuccessful = false;
		
		return GracefulError("SUBMIT-REVIEW-FORUM","DBERROR","A database error has occured");
	}
	
	//check the article is in review
	if (!mSP.FetchReviewForumMemberDetails(iH2G2ID))
	{
		
		*pbSuccessful = false;
		
		return GracefulError("SUBMIT-REVIEW-FORUM","BADH2G2ID","The article is not in a review forum");
	}
	
	int iSubmitterID = mSP.GetIntField("SubmitterID");
	int iPostID = mSP.GetIntField("PostID");
	*iThreadID = mSP.GetIntField("ThreadID");
	*iForumID = mSP.GetIntField("ForumID");
	int iActualReviewForumID = mSP.GetIntField("ReviewForumID");
	
	//make sure that we are in the right review forum for the article
	if (iReviewForumID != iActualReviewForumID)
	{
		
		*pbSuccessful = false;
		
		return GracefulError("SUBMIT-REVIEW-FORUM","BADRFID","The article is in a different review forum");
	}
	
	//Permission has been verified by the caller so don't check
	if (!bHasPermission)
	{
		//ok if you're an editor
		if (!mViewer.GetIsEditor())
		{
			//ok if you are the author
			if (!(mGuideEntry.GetEditorID() == mViewer.GetUserID()))
			{
				//ok if you are the submitter
				if (!(mViewer.GetUserID() == iSubmitterID))
				{
					
					*pbSuccessful = false;
					
					return GracefulError("SUBMIT-REVIEW-FORUM","BADUSER","You do not have permission to move the thread");
				}
			}
		}
	}
	
	//initialise the review forum
	CReviewForum mReviewForum(m_InputContext);
	
	if (!mReviewForum.InitialiseViaReviewForumID(iReviewForumID))
	{
		*pbSuccessful = false;	
		return GracefulError("SUBMIT-REVIEW-FORUM","NOREVIEW","Invalid Review Forum ID");
	}
	
	//move the thread	
	mSP.MoveThread(*iThreadID,mGuideEntry.GetForumID());
	
	if (!mSP.GetBoolField("Success"))
	{
		*pbSuccessful = false;	
		return GracefulError("SUBMIT-REVIEW-FORUM","NOMOVE","Failed to move thread to article");
	}
	
	if (!mSP.RemoveArticleFromPeerReview(iH2G2ID))
	{
		mSP.UndoThreadMove(*iThreadID,0);
//.........这里部分代码省略.........
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:ReviewSubmissionForum.cpp

示例3: Build

bool CEditReviewForumBuilder::Build(CWholePage* pPage)
{
	CEditReviewForumForm	mForm(m_InputContext);

	if(!InitPage(pPage, "EDITREVIEW", true))
	{
		return false;
	}

	CTDVString	sMode;

	m_InputContext.GetParamString("mode", sMode);
	if (sMode.GetLength() > 0)
	{
		pPage->SetAttribute("H2G2", "MODE", sMode);
	}

	//check that they have the privileges

	CUser* pUser = m_InputContext.GetCurrentUser();
	if (pUser == NULL || !pUser->GetIsEditor())	
	{
		pPage->AddInside("H2G2","<EDITREVIEWFORM><ERROR TYPE='NOEDIT'>Current User does not have permission to edit the Review Forum</ERROR></EDITREVIEWFORM>");		
		return true;
	}


	
	CTDVString sAction = "Edit";

	if (m_InputContext.ParamExists("action"))
	{
		m_InputContext.GetParamString("action",sAction);
	}

	if (sAction.CompareText("Update"))
	{
		
		int iReviewForumID = 0;
		
		if (m_InputContext.ParamExists("id"))
		{
			iReviewForumID = m_InputContext.GetParamInt("id");
		}
		else
		{
			pPage->AddInside("H2G2","<EDITREVIEWFORM><ERROR TYPE='BADPARAM'>The parameters are invalid</ERROR></EDITREVIEWFORM>");
			return true;
		}


		CTDVString sName;
		CTDVString sURL;
		bool bRecommendable = false;
		int iIncubateTime = 0;

		m_InputContext.GetParamString("name",sName);
		m_InputContext.GetParamString("url",sURL);
		
		if (m_InputContext.ParamExists("recommend"))
		{
			if (m_InputContext.GetParamInt("recommend") == 1)
			{
				bRecommendable = true;
				iIncubateTime = m_InputContext.GetParamInt("incubate");
			}
			else
			{
				bRecommendable = false;
			}

			if (!mForm.RequestUpdate(iReviewForumID,sName,sURL,bRecommendable,iIncubateTime,m_InputContext.GetSiteID()))
			{
				pPage->AddInside("H2G2","<EDITREVIEWFORM><ERROR TYPE='UPDATE'>Error occured while updating</ERROR></EDITREVIEWFORM>");
				return true;
			}

			//sitedata needs to be update for updates

			m_InputContext.SiteDataUpdated();
			m_InputContext.Signal("/Signal?action=recache-site");
		}
		else
		{
			pPage->AddInside("H2G2","<EDITREVIEWFORM><ERROR TYPE='BADPARAM'>The parameters are invalid</ERROR></EDITREVIEWFORM>");
			return true;
		}
	}
	//we should have a blank form and an add button
	else if (sAction.CompareText("AddNew"))
	{
		pPage->AddInside("H2G2","<EDITREVIEWFORM><BLANKFORM></BLANKFORM></EDITREVIEWFORM>");
		return true;
	}
	else if (sAction.CompareText("DoAddNew"))
	{
		CTDVString sName;
		CTDVString sURL;
		bool bRecommendable = false;
		int iIncubateTime = 0;
//.........这里部分代码省略.........
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:EditReviewForumBuilder.cpp


注:本文中的CUser::GetIsEditor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。