Exemple #1
0
void modifySyslog_hand(struct list *lpublic, struct list *lsystem)
{
  char na[N]={0};  
  char log[10]={0};
  char oper[10]={0};
  int ret = 0;
  
  memset(na,0,N);					 /*清空临时变量*/
  memset(log,0,10);
  memset(oper,0,10);
  cgiFormStringNoNewlines("a_name", na, N);
  cgiFormStringNoNewlines("log_lever",log,10);  
  cgiFormStringNoNewlines("oper_lever",oper,10);  

  ret = mod_user_syslog_by_name(na,log,oper);
  
  if(ret == 1)
  {
	  ShowAlert(search(lpublic,"oper_succ"));
  }
  else 
  {
	  ShowAlert(search(lpublic,"oper_fail"));
  }
}
Exemple #2
0
void  dhcp_relay_status(struct list *lcontrol,struct list *lpublic,char *addn)
{
	if(checkuser_group(addn)==0)
	{
		char allslotid[10] = {0};
		int allslot_id = 0;
		cgiFormStringNoNewlines("allslot",allslotid,sizeof(allslotid));
		allslot_id = atoi(allslotid);
		char status[20] = {0};
		cgiFormStringNoNewlines("State",status,20);
		unsigned int ifenable = 0;
		int ret = -1;
		/////enable or disable 
		if (strcmp(status,"stop") == 0)
		{
			ifenable = 0;
		}
		else if (strcmp(status,"start") == 0)
		{
			ifenable = 1;
		}
		ret = ccgi_set_relay_enable(ifenable,allslot_id);
		if (ret == 1)
		{
			ShowAlert(search(lpublic,"oper_succ"));
		}
		else
		{
			ShowAlert(search(lpublic,"oper_fail"));
		}	
	}
}
Exemple #3
0
///Daje użytkownikowi możliwość wprowadzenia ścieżki do sclang
bool getSCPath()
{
	FILE* pathFile=fopen(SC_PATH_FILE, "r");
	if(pathFile!=NULL)
	{
		fgets(sclangPath, MAX_PATH, pathFile);
		if(existsTest(sclangPath))
		{
			return true;
		}
	}
	fclose(pathFile);
	
	ShowAlert(L"SuperCollider Path", L"To launch program you must provide path to sclang in SuperCollider folder.");
	getOpenFile(sclangPath, MAX_PATH);
	
	printf("Selected path: %s\n", sclangPath);
	
	if(existsTest(sclangPath))
	{
		return true;
	}
	else
	{
		ShowAlert(L"SuperCollider Path", L"Patch to sclang is incorrect!");
		return false;
	}
}
Exemple #4
0
		void Client::TakeMapShot(){
			
			try{
				std::string name = MapShotPath();
				{
					std::unique_ptr<IStream> stream(FileManager::OpenForWriting(name.c_str()));
					try{
						GameMap *map = GetWorld()->GetMap();
						if(map == nullptr){
							SPRaise("No map loaded");
						}
						map->Save(stream.get());
					}catch(...){
						throw;
					}
				}
				
				std::string msg;
				msg = _Tr("Client", "Map saved: {0}", name);
				ShowAlert(msg, AlertType::Notice);
			}catch(const Exception& ex){
				std::string msg;
				msg = _Tr("Client", "Saving map failed: ");
				msg += ex.GetShortMessage();
				ShowAlert(msg, AlertType::Error);
				SPLog("Saving map failed: %s", ex.what());
			}catch(const std::exception& ex){
				std::string msg;
				msg = _Tr("Client", "Saving map failed: ");
				msg += ex.what();
				ShowAlert(msg, AlertType::Error);
				SPLog("Saving map failed: %s", ex.what());
			}
		}
Exemple #5
0
void Config_load_balance(struct list *lpublic,struct list *lcon)
{
  int ret;	
  char *load_balance=(char *)malloc(15);
  memset(load_balance,0,15);
  cgiFormStringNoNewlines("load_balance",load_balance,15);  

  ccgi_dbus_init();
  ret=set_load_balance(load_balance);     /*mode列表:based-port|based-mac|based-ip|based-L4|mac+ip|mac+L4|ip+L4|mac+ip+L4*/
                                          /*返回0表示失败,返回1表示成功,返回-1表示there no trunk exist*/
                                          /*返回-2表示load-balance Mode same to corrent mode*/
										  /*返回-3表示设备不支持这种模式*/	
  switch(ret)
  {
	case 0:ShowAlert(search(lcon,"con_load_balance_fail"));
		   break;
	case 1:ShowAlert(search(lcon,"con_load_balance_succ"));
   	       break;
	case -1:ShowAlert(search(lcon,"no_trunk"));
		    break;
	case -2:ShowAlert(search(lcon,"same_load_balance"));
	   	    break;	
    //kehao add 2011-04-26			
    /////////////////////////////////////////////////////
	case -3:ShowAlert(search(lcon,"device_unsupported_balance_mode"));
	   	    break;
    /////////////////////////////////////////////////////
	
 }   
 free(load_balance);
}
nsresult
nsAlertsIconListener::StartRequest(const nsAString & aImageUrl, bool aInPrivateBrowsing)
{
  if (mIconRequest) {
    // Another icon request is already in flight.  Kill it.
    mIconRequest->Cancel(NS_BINDING_ABORTED);
    mIconRequest = nullptr;
  }

  nsCOMPtr<nsIURI> imageUri;
  NS_NewURI(getter_AddRefs(imageUri), aImageUrl);
  if (!imageUri)
    return ShowAlert(nullptr);

  nsCOMPtr<imgILoader> il(do_GetService("@mozilla.org/image/loader;1"));
  if (!il)
    return ShowAlert(nullptr);

  // XXX: Hrmm.... Bypass cache, or isolate to imageUrl?
  nsresult rv = il->LoadImageXPCOM(imageUri, imageUri, nullptr,
                                   NS_LITERAL_STRING("default"), nullptr, nullptr,
                                   this, nullptr,
                                   aInPrivateBrowsing ? nsIRequest::LOAD_ANONYMOUS :
                                                        nsIRequest::LOAD_NORMAL,
                                   nullptr, 0 /* use default */,
                                   getter_AddRefs(mIconRequest));
  if (NS_FAILED(rv))
    return rv;

  return NS_OK;
}
Exemple #7
0
void Set_Master_port(int id,struct list *lpublic,struct list *lcon)
{
  int ret;	
  char *port_name=(char *)malloc(10);
  memset(port_name,0,10);
  cgiFormStringNoNewlines("port",port_name,10);  
  if((strcmp(port_name,"")!=0)&&(strchr(port_name,' ')==NULL))			  /*port不能为空*/
  {
	ccgi_dbus_init();
	ret=set_master_port(id,port_name);
	switch(ret)
	{
	  case 0:ShowAlert(search(lcon,"set_master_port_fail"));
			 break;
	  case 1:ShowAlert(search(lcon,"set_master_port_succ"));
   		     break;
	  case -1:ShowAlert(search(lcon,"unknown_portno_format"));
		      break;
	  case -2:ShowAlert(search(lcon,"port_not_exist"));
			  break;			
	  case -3:ShowAlert(search(lcon,"trunk_not_exist"));
			  break;
	  case -4:ShowAlert(search(lcon,"port_is_not_trunk_member"));
			  break;	
	  case -5:ShowAlert(search(lcon,"port_is_l3"));
			  break;	
	  case -6:ShowAlert(search(lpublic,"error"));
			  break;	
   }   
 }
 else
   ShowAlert(search(lcon,"enter_port"));
 free(port_name);
}
Exemple #8
0
void modifyprivilege_hand(struct list *lpublic, struct list *lsystem)
{
  char na[N],apri[N];  
  int ret=10;
  int status;
  memset(na,0,N);					 /*清空临时变量*/
  memset(apri,0,N);
  cgiFormStringNoNewlines("a_name", na, N);
  cgiFormStringNoNewlines("privilege",apri,N);  
  char *command = (char *)malloc(PATH_LENG); /*修改权限参数*/
  memset(command, 0, PATH_LENG);
  strcat(command,"userrole.sh");
  strcat(command," ");
  strcat(command,na);
  strcat(command," ");
  strcat(command,apri);

  if(strcmp(na,"")!=0)
  	{
  	  if(checkuser_exist(na)==0)
  	  	{
  	  		if(strcmp(na,"admin")!=0)
  	  		{
		  
/***********************************************************************************/
	    		/*调用修改权限脚本*/
				status = system(command);
				ret = WEXITSTATUS(status);
	    		if(ret == 0)
	    			ShowAlert(search(lpublic,"oper_succ"));
	    		else 
					ShowAlert(search(lpublic,"oper_fail"));

/***********************************************************************************/
  	  		}
			else
			{
					ShowAlert(search(lsystem,"admin_pri"));
			}
	    }
	  else
	  	{
	  	  ShowAlert(search(lsystem,"user_not_exist"));
	  	}
  	}
  else
  	{
  		ShowAlert(search(lpublic,"name_not_null"));
  	}

  	
  free(command);
}
Exemple #9
0
void DeleteV3user(DBusConnection *select_connection,struct list *lpublic,struct list *lsnmpd)
{
	int ret = AC_MANAGE_DBUS_ERROR;
	char V3userName[25] = { 0 };
	int ret_c = 0;
	
	memset(V3userName,0,sizeof(V3userName));
    cgiFormStringNoNewlines("V3userName", V3userName, 25);
	if(strcmp(V3userName,""))
	{
	    ret_c = check_snmp_name(V3userName, 0);
		if((ret_c == -2)||(ret_c == -1)) 
		{
			ShowAlert(search(lsnmpd,"v3user_lenth_illegal"));
			return;
		}
		else if(ret_c == -3)
		{
			ShowAlert(search(lsnmpd,"v3user_illegal1"));
			return;
		}
		else if(ret_c == -4) 
		{
			ShowAlert(search(lsnmpd,"v3user_illegal2"));
			return;
		}
		else if(ret_c == -5)
		{
			ShowAlert(search(lsnmpd,"v3user_illegal3"));
			return;
		}		
	
		ret = ac_manage_config_snmp_del_v3user(select_connection, V3userName);
	    if(AC_MANAGE_SUCCESS == ret) 
		{
			ShowAlert(search(lsnmpd,"delete_v3user_succ"));
	    }
	    else if(AC_MANAGE_SERVICE_ENABLE == ret) 
		{
			ShowAlert(search(lsnmpd,"disable_snmp_service"));
	    }
	    else if(AC_MANAGE_CONFIG_NONEXIST == ret)
		{
			ShowAlert(search(lsnmpd,"v3user_not_exist"));
	    }
	    else if(AC_MANAGE_DBUS_ERROR == ret)
		{
			ShowAlert(search(lsnmpd,"delete_v3user_fail"));
	    }
	    else 
		{
			ShowAlert(search(lsnmpd,"delete_v3user_fail"));
	    }
	}	
}
Exemple #10
0
void CBOINCBaseFrame::ShowConnectionBadPasswordAlert( bool bUsedDefaultPassword, int iReadGUIRPCAuthFailure ) {
    CSkinAdvanced*      pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
    wxString            strDialogTitle = wxEmptyString;


    wxASSERT(pSkinAdvanced);
    wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));


    wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::ShowConnectionBadPasswordAlert - Function Begin"));

    // %s is the application name
    //    i.e. 'BOINC Manager', 'GridRepublic Manager'
    strDialogTitle.Printf(
        _("%s - Connection Error"),
        pSkinAdvanced->GetApplicationName().c_str()
    );

    if ( bUsedDefaultPassword ) {
#ifdef __WXMSW__
        if ( EACCES == iReadGUIRPCAuthFailure || ENOENT == iReadGUIRPCAuthFailure ) {
            ShowAlert(
                strDialogTitle,
                _("You currently are not authorized to manage the client.\nPlease contact your administrator to add you to the 'boinc_users' local user group."),
                wxOK | wxICON_ERROR
            );
        } else
#endif
        {
            ShowAlert(
                strDialogTitle,
#ifndef __WXMAC__
                _("Authorization failed connecting to running client.\nMake sure you start this program in the same directory as the client."),
#else
                _("Authorization failed connecting to running client."),
#endif
                wxOK | wxICON_ERROR
            );
        }
    } else {
        ShowAlert(
            strDialogTitle,
            _("The password you have provided is incorrect, please try again."),
            wxOK | wxICON_ERROR
        );
    }

    wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::ShowConnectionBadPasswordAlert - Function End"));
}
Exemple #11
0
int main(int argc, char **argv) {
    try {
        std::string memMaxArg = std::string();
        char * varMemMax = getenv("NEXTFRACTAL_MAX_MEMORY");
        int varMemMaxLen = varMemMax != NULL ? strlen(varMemMax) : 0;
        if (varMemMaxLen > 0) {
            memMaxArg.append("-Xmx");
            memMaxArg.append(std::to_string(std::stoi(varMemMax)));
            memMaxArg.append("m");
        } else {
            memMaxArg.append("-Xmx3g");
        }
        std::string basePath = GetBasePath(GetExePath());
        std::cout << "Base path " << basePath << std::endl;
        std::string jarsPath = basePath + "/../Resources";
        std::string classpathArg = "-Djava.class.path=" + GetClasspath(jarsPath);
        std::string libPathArg = "-Djava.library.path=" + basePath + "/../Resources";
        std::string locPathArg = "-Dbrowser.location=" + basePath + "/../../../examples";
        const char *vm_arglist[] = {
            "-Djava.util.logging.config.class=com.nextbreakpoint.nextfractal.runtime.LogConfig",
            classpathArg.c_str(),
            libPathArg.c_str(),
            locPathArg.c_str(),
            memMaxArg.c_str(),
            0
        };
        struct start_args args(vm_arglist, "com/nextbreakpoint/nextfractal/runtime/javafx/NextFractalApp");
        pthread_t thr;
        pthread_create(&thr, NULL, start_java, &args);
        CFRunLoopRun();
    } catch (const std::runtime_error& e) {
        ShowAlert("Did you install Java JDK 8 or later?", e);
    }
}
void
CGame::Finish (void)
{
	StopFuse();

	if (mSoundFxExplosion)
		Mix_PlayChannel (-1, mSoundFxExplosion, 0);

	mGameRunning = false;
	mGameFinished = true;
	mGameEndTicks = 0;

	mRemovedEntries.clear();
	for (int x = 0; x < sGridColCount; x++)
		for (int y = 0; y < sGridRowCount; y++)
			mRemovedEntries.push_back ({ x, y });

	StartExplode();

	// wait a fraction of a second to sync the sound better
	SDL_Delay (200);

	SDL_Point newPos = { 400, 200 };
	ShowAlert ("Press N to play again", &newPos);
}
void
CGame::Prepare (void)
{
	mScore = 0;

	mGameBoard->Fill();

	mArtifacts.Resize (sGridColCount, sGridRowCount);

	for (int x = 0; x < sGridColCount; x++)
	{
		for (int y = 0; y < sGridRowCount; y++)
		{
			int type = mGameBoard->Get (x,y);
			SDL_Point thePos = GetCellPosition ({ x, y });

			CArtifactPtr artifact = std::make_shared<CArtifact> (mStage, mArtifactTextures[type]);

			artifact->SetPosition (thePos);
			artifact->SetClip (&mClipRect);

			mArtifacts.Set (x, y, artifact);
			mStage->AddDrawable (artifact);
		}
	}

	if (mGameBoard->RemoveCombinations (mRemovedEntries))
		StartExplode();

	StartDropping();

	ShowAlert ("Press N to start");
}
void DialogDriver_Cocoa::Error( CString sError, CString ID )
{
	CFStringRef error = CFStringCreateWithCString( NULL, sError, kCFStringEncodingASCII );
	ShowAlert(kAlertStopAlert, error, CFSTR("OK"));

	CFRelease(error);
}
NS_IMETHODIMP
nsAlertsIconListener::OnStopFrame(imgIRequest* aRequest,
                                  PRUint32 aFrame)
{
  if (aRequest != mIconRequest)
    return NS_ERROR_FAILURE;

  if (mLoadedFrame)
    return NS_OK; // only use one frame

  nsCOMPtr<imgIContainer> image;
  nsresult rv = aRequest->GetImage(getter_AddRefs(image));
  if (NS_FAILED(rv))
    return rv;

  nsCOMPtr<nsIImageToPixbuf> imgToPixbuf =
    do_GetService("@mozilla.org/widget/image-to-gdk-pixbuf;1");

  GdkPixbuf* imagePixbuf = imgToPixbuf->ConvertImageToPixbuf(image);
  if (!imagePixbuf)
    return NS_ERROR_FAILURE;

  ShowAlert(imagePixbuf);

  g_object_unref(imagePixbuf);

  mLoadedFrame = true;
  return NS_OK;
}
Exemple #16
0
void
Project::AddLibrary(const char *path)
{
	if (!path)
		return;
	
	DPath libpath(path);
	if (!BEntry(libpath.GetFullPath()).Exists())
	{
		libpath = FindLibrary(libpath.GetFileName());
		if (libpath.IsEmpty())
		{
			if (gBuildMode)
			{
				printf("%s seems to be missing\n", path);
			}
			else
			{
				BString err;
				err << path << " seems to be missing. Do you want to remove it from the project?";
				int32 result = ShowAlert(err.String(),"Remove","Keep");
				if (result == 0)
					return;
			}
		}
	}
	
	if (!HasLibrary(libpath.GetFullPath()))
	{
		STRACE(1,("%s: Added library %s\n",GetName(),libpath.GetFullPath()));
		fLibraryList.AddItem(gFileFactory.CreateSourceFileItem(libpath.GetFullPath()));
	}
}
nsresult
nsAlertsIconListener::OnLoadComplete(imgIRequest* aRequest)
{
  NS_ASSERTION(mIconRequest == aRequest, "aRequest does not match!");

  uint32_t imgStatus = imgIRequest::STATUS_ERROR;
  nsresult rv = aRequest->GetImageStatus(&imgStatus);
  NS_ENSURE_SUCCESS(rv, rv);
  if ((imgStatus & imgIRequest::STATUS_ERROR) && !mLoadedFrame) {
    // We have an error getting the image. Display the notification with no icon.
    ShowAlert(nullptr);

    // Cancel any pending request
    mIconRequest->Cancel(NS_BINDING_ABORTED);
    mIconRequest = nullptr;
  }

  nsCOMPtr<imgIContainer> image;
  rv = aRequest->GetImage(getter_AddRefs(image));
  if (NS_WARN_IF(NS_FAILED(rv) || !image)) {
    return rv;
  }

  // Ask the image to decode at its intrinsic size.
  int32_t width = 0, height = 0;
  image->GetWidth(&width);
  image->GetHeight(&height);
  image->RequestDecodeForSize(nsIntSize(width, height), imgIContainer::FLAG_NONE);

  return NS_OK;
}
bool CurrencyBox::Validate(bool alert)
{
	if(strlen(Text())<1)
		SetText("0");

	Fixed amount;
	if(gCurrentLocale.StringToCurrency(Text(),amount)!=B_OK)
	{
		if(alert)
		{
			ShowAlert(TRANSLATE("Capital Be didn't understand the amount."),
						TRANSLATE("There may be a typo or the wrong kind of currency symbol "
						"for this account."));
			MakeFocus(true);
		}
		return false;
	}
	else
	{
		BString string;
		gCurrentLocale.CurrencyToString(amount,string);
		SetText(string.String());
	}
	
	return true;
}
Exemple #19
0
entry_ref
MakeProjectFile(DPath folder, const char *name, const char *data, const char *type)
{
	entry_ref ref;
	
	DPath path(folder);
	path.Append(name);
	BEntry entry(path.GetFullPath());
	if (entry.Exists())
	{
		BString errstr = path.GetFullPath();
		errstr << TR(" already exists. Do you want to overwrite it?");
		int32 result = ShowAlert(errstr.String(),TR("Overwrite"),TR("Cancel"));
		if (result == 1)
			return ref;
	}
	
	BFile file(path.GetFullPath(),B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
	
	if (data && strlen(data) > 0)
		file.Write(data,strlen(data));
	
	BString fileType = (type && strlen(type) > 0) ? type : "text/x-source-code";
	file.WriteAttr("BEOS:TYPE",B_STRING_TYPE, 0, fileType.String(),
						fileType.Length() + 1);
	
	file.Unset();
	entry.GetRef(&ref);
	return ref;
}
Dialog::Result DialogDriver_MacOSX::AbortRetryIgnore( RString sMessage, RString sID )
{
	CFBundleRef bundle = CFBundleGetMainBundle();
	CFStringRef sIgnore = LSTRING( bundle, "Ignore" );
	CFStringRef sRetry = LSTRING( bundle, "Retry" );
	CFStringRef sAbort = LSTRING( bundle, "Abort" );
	CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage, sIgnore, sRetry, sAbort );

	CFRelease( sIgnore );
	CFRelease( sRetry );
	CFRelease( sAbort );
	switch( result )
	{
	case kCFUserNotificationDefaultResponse:
		Dialog::IgnoreMessage( sID );
		return Dialog::ignore;
	case kCFUserNotificationAlternateResponse:
		return Dialog::retry;
	case kCFUserNotificationOtherResponse:
	case kCFUserNotificationCancelResponse:
		return Dialog::abort;
	default:
		FAIL_M( ssprintf("Invalid response: %d.", int(result)) );
	}
}
Exemple #21
0
void CBOINCBaseFrame::ShowNotCurrentlyConnectedAlert() {
    CSkinAdvanced*      pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
    CMainDocument*      pDoc = wxGetApp().GetDocument();
    wxString            strConnectedCompter = wxEmptyString;
    wxString            strDialogTitle = wxEmptyString;
    wxString            strDialogMessage = wxEmptyString;

    wxASSERT(pSkinAdvanced);
    wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));

    wxASSERT(pDoc);
    wxASSERT(wxDynamicCast(pDoc, CMainDocument));

    wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::ShowNotCurrentlyConnectedAlert - Function Begin"));

    // Did BOINC crash on local computer? If so restart it and reconnect.
    pDoc->GetConnectedComputerName(strConnectedCompter);
    if (pDoc->IsComputerNameLocal(strConnectedCompter)) {
        if (pDoc->m_pClientManager->AutoRestart()) {
            boinc_sleep(0.5);       // Allow time for Client to restart
            if (pDoc->m_pClientManager->IsBOINCCoreRunning()) {
                pDoc->Reconnect();
                return;
            }
        } else {
            // Don't ask whether to reconnect to local client if it is not running
            if (!pDoc->m_pClientManager->IsBOINCCoreRunning()) {
                return;
            }
        }
    }

    // %s is the application name
    //    i.e. 'BOINC Manager', 'GridRepublic Manager'
    strDialogTitle.Printf(
        _("%s - Connection Status"),
        pSkinAdvanced->GetApplicationName().c_str()
    );

    // 1st %s is the application name
    //    i.e. 'BOINC Manager', 'GridRepublic Manager'
    // 2nd %s is the project name
    //    i.e. 'BOINC', 'GridRepublic'
    // 3nd %s is the project name
    //    i.e. 'BOINC', 'GridRepublic'
    strDialogMessage.Printf(
        _("%s is not currently connected to a %s client.\nPlease use the 'Advanced\\Select Computer...' menu option to connect up to a %s client.\nTo connect up to your local computer please use 'localhost' as the host name."),
        pSkinAdvanced->GetApplicationName().c_str(),
        pSkinAdvanced->GetApplicationShortName().c_str(),
        pSkinAdvanced->GetApplicationShortName().c_str()
    );
    ShowAlert(
        strDialogTitle,
        strDialogMessage,
        wxOK | wxICON_ERROR
    );

    wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::ShowNotCurrentlyConnectedAlert - Function End"));
}
Exemple #22
0
		void Client::LocalPlayerBuildError(BuildFailureReason reason) {
			SPADES_MARK_FUNCTION();

			if (!cg_alerts) {
				PlayAlertSound();
				return;
			}

			switch (reason) {
				case BuildFailureReason::InsufficientBlocks:
					ShowAlert(_Tr("Client", "Insufficient blocks."), AlertType::Error);
					break;
				case BuildFailureReason::InvalidPosition:
					ShowAlert(_Tr("Client", "You cannot place a block there."), AlertType::Error);
					break;
			}
		}
Exemple #23
0
void deleteuser_hand(struct list *lpublic, struct list *lsystem)
{
  int result;   
  char **responses;
  int ret,status;
  int count = 0;            /*记录删除成功的个数*/

  
  result = cgiFormStringMultiple("check", &responses);
  if(result == cgiFormNotFound)           /*如果没有选择任何用户*/
    ShowAlert(search(lsystem,"select_user"));
  else                  
  {
    int i = 0;	

    while(responses[i])
    {
		char *command = (char*)malloc(PATH_LENG);  /*command存放命令行参数*/
		memset(command,0,PATH_LENG);        
		strcat(command,"userdel.sh");
		strcat(command," ");
		strcat(command,responses[i]);
		status = system(command);		 /*删除用户*/
		ret = WEXITSTATUS(status);

        if(ret==0)
        {
 		  count++;
        }
		
		free(command); 
		i++;
	}
	
    if(count)
	{
	  ShowAlert(search(lpublic,"oper_succ"));     	       	
	}
	else
	{
	  ShowAlert(search(lpublic,"oper_fail"));
	}
	cgiStringArrayFree(responses);
  }
}
Exemple #24
0
void Config_port_state(int id,struct list *lpublic,struct list *lcon)
{
  int ret;	
  char *port_name=(char *)malloc(10);
  char *port_state=(char *)malloc(10);
  memset(port_name,0,10);
  cgiFormStringNoNewlines("port_num",port_name,10);  
  memset(port_state,0,10);
  cgiFormStringNoNewlines("port_state",port_state,10);  

  ccgi_dbus_init();
  ret=set_port_state(id,port_name,port_state);  
  switch(ret)
  {
	case 0:ShowAlert(search(lcon,"con_port_state_fail"));
		   break;
	case 1:ShowAlert(search(lcon,"con_port_state_succ"));
   	       break;
	case -1:ShowAlert(search(lcon,"unknown_portno_format"));
		    break;
	case -2:ShowAlert(search(lcon,"port_is_not_trunk_member"));
	   	    break;			
    case -3:ShowAlert(search(lcon,"port_already_enable"));
	    	break;
	case -4:ShowAlert(search(lcon,"port_not_enable"));
			break;	
	case -5:ShowAlert(search(lpublic,"error"));
			break;	
 }   
 free(port_name);
 free(port_state);
}
Exemple #25
0
void
AlertOK(const char *fmt, ...)
{
   va_list             args;

   va_start(args, fmt);
   ShowAlert(_("Attention !!!"), _("OK"), NULL, NULL, fmt, args);
   va_end(args);
}
void DialogDriver_Cocoa::OK( CString sMessage, CString ID )
{
	CFStringRef message = CFStringCreateWithCString(NULL, sMessage, kCFStringEncodingASCII);
	SInt16 result = ShowAlert(kAlertNoteAlert, message, CFSTR("OK"), CFSTR("Don't show again"));

	CFRelease(message);
	if( result == kAlertStdAlertCancelButton )
		Dialog::IgnoreMessage( ID );
}
void DialogDriver_MacOSX::OK( RString sMessage, RString sID )
{
	CFBundleRef bundle = CFBundleGetMainBundle();
	CFStringRef sDSA = LSTRING( bundle, "Don't show again" );
	CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage, CFSTR("OK"), sDSA );

	CFRelease( sDSA );
	if( result == kCFUserNotificationAlternateResponse )
		Dialog::IgnoreMessage( sID );
}
Exemple #28
0
void
AlertX(const char *title, const char *ignore,
       const char *restart, const char *quit, const char *fmt, ...)
{
   va_list             args;

   va_start(args, fmt);
   ShowAlert(title, ignore, restart, quit, fmt, args);
   va_end(args);
}
Exemple #29
0
void
Alert(const char *fmt, ...)
{
   va_list             args;

   va_start(args, fmt);
   ShowAlert(_("Enlightenment Message Dialog"), _("Ignore this"),
	     _("Restart Enlightenment"), _("Quit Enlightenment"), fmt, args);
   va_end(args);
}
Exemple #30
0
void  ShowIPaddr(struct list *lcontrol,struct list *lpublic,char*addn)
{
	if(checkuser_group(addn)==0)
	{
		char * status = (char *)malloc(10);	
		memset(status,0,10);		
		cgiFormStringNoNewlines("State",status,10);
		char allslot_str[10] = {0};
		int allslot_id = 0;
		cgiFormStringNoNewlines("allslot",allslot_str,sizeof(allslot_str));
		allslot_id = atoi(allslot_str);
		int sflag = -1;
		ccgi_dbus_init();
		if(!strcmp(status,"start"))
		{	
			sflag=ip_dhcp_server_enable("enable",allslot_id);		
            if(sflag==1)
            {
				ShowAlert(search(lcontrol,"DHCP_STAT1"));	 
            }
			else
			{
				ShowAlert(search(lcontrol,"DHCP_STAT10"));
			}
		}
		else
		{
			sflag=ip_dhcp_server_enable("disable",allslot_id);	
			if(sflag==1)
			{
				ShowAlert(search(lcontrol,"DHCP_STAT0"));
			}
			else
			{
				ShowAlert(search(lcontrol,"DHCP_STAT01"));
			}

		}
		free(status);
	}
}