void AliasCommands(pentry entries[], int x) { if(!strcmp(gcPage,"Alias")) { char cServerGroup[100]={""}; char cJobData[100]={""}; ProcessAliasVars(entries,x); if(!strcmp(gcFunction,"New")) { if(guPermLevel>=10) { sprintf(gcNewStep,"Confirm "); gcInputStatus[0]=0; gcMessage="Enter/modify data, review, then confirm. Any other action to cancel."; SetAliasFieldsOn(); } else gcMessage="<blink>Error:</blink> Denied by permission settings"; } else if(!strcmp(gcFunction,"Confirm New")) { if(guPermLevel>=10) { if(ValidateAliasInput()) { sprintf(gcNewStep,"Confirm "); gcInputStatus[0]=0; gcMessage="Enter/modify data, review, then confirm. Any other action to cancel."; htmlAlias(); } InsertAlias(); sprintf(cServerGroup,"%s",ForeignKey("tServerGroup","cLabel",uServerGroup)); sprintf(cJobData,"uAlias=%u;\ncUser=%s;\ncTargetEmail=%s;\n", uAlias,cUser,cTargetEmail); SubmitJob("NewAlias","",cUser,cServerGroup,cJobData,0,0, guLoginClient,guLoginClient); } else gcMessage="<blink>Error:</blink> Denied by permission settings"; } else if(!strcmp(gcFunction,"Modify")) { if(uAllowMod(uOwner,uCreatedBy)) { sprintf(gcModStep,"Confirm "); gcInputStatus[0]=0; gcMessage="Enter/modify data, review, then confirm. Any other action to cancel."; SetAliasFieldsOn(); } else gcMessage="<blink>Error:</blink> Denied by permission settings"; } else if(!strcmp(gcFunction,"Confirm Modify")) { if(uAllowMod(uOwner,uCreatedBy)) { if(ValidateAliasInput()) { sprintf(gcModStep,"Confirm "); gcInputStatus[0]=0; gcMessage="Enter/modify data, review, then confirm. Any other action to cancel."; htmlAlias(); } UpdateAlias(); sprintf(cServerGroup,"%s",ForeignKey("tServerGroup","cLabel",uServerGroup)); sprintf(cJobData,"uAlias=%u;\ncUser=%s;\ncTargetEmail=%s;\n", uAlias,cUser,cTargetEmail); SubmitJob("ModAlias","",cUser,cServerGroup,cJobData,0,0, guLoginClient,guLoginClient); } else gcMessage="<blink>Error:</blink> Denied by permission settings"; } else if(!strcmp(gcFunction,"Delete")) { if(uAllowDel(uOwner,uCreatedBy)) { sprintf(gcDelStep,"Confirm "); gcMessage="Double check you have selected the correct record to delete. Then confirm. Any other action to cancel."; } else gcMessage="<blink>Error:</blink> Denied by permission settings"; } else if(!strcmp(gcFunction,"Confirm Delete")) { if(uAllowDel(uOwner,uCreatedBy)) { DeleteAlias(); sprintf(cServerGroup,"%s",ForeignKey("tServerGroup","cLabel",uServerGroup)); sprintf(cJobData,"uAlias=%u;\ncUser=%s;\ncTargetEmail=%s;\n", uAlias,cUser,cTargetEmail); SubmitJob("DelAlias","",cUser,cServerGroup,cJobData,0,0, guLoginClient,guLoginClient); } else gcMessage="<blink>Error:</blink> Denied by permission settings"; } htmlAlias(); } }//void AliasCommands(pentry entries[], int x)
/***************************************************************************** * Routine to load a library from given open file. * *****************************************************************************/ PriorQue *LoadLibraryAux(WinEDA_DrawFrame * frame, LibraryStruct * Library, FILE *libfile, int *NumOfParts) { int LineNum = 0; char Line[1024]; PriorQue *PQ = NULL; EDA_LibComponentStruct *LibEntry; wxString msg; wxBusyCursor ShowWait; // Display a Busy Cursor.. *NumOfParts = 0; if ( GetLine(libfile, Line, &LineNum, sizeof(Line) ) == NULL) { msg = _("File <") + Library->m_Name + _("> is empty!"); DisplayError(frame, msg); return NULL; } if( strnicmp(Line, LIBFILE_IDENT, 10) != 0) { msg = _("File <") + Library->m_Name + _("> is NOT EESCHEMA library!"); DisplayError(frame, msg); return NULL; } if ( Library ) Library->m_Header = CONV_FROM_UTF8(Line); PQInit(&PQ); PQCompFunc((PQCompFuncType) LibraryEntryCompare); while (GetLine(libfile, Line, &LineNum, sizeof(Line)) ) { if (strnicmp(Line, "$HEADER", 7) == 0) { if ( Library ) { if ( ! Library->ReadHeader(libfile, &LineNum) ) { msg = _("Library <") + Library->m_Name + _("> header read error"); DisplayError(frame, msg, 30); } } continue; } if (strnicmp(Line, "DEF", 3) == 0) { /* Read one DEF/ENDDEF part entry from library: */ LibEntry = Read_Component_Definition(frame, Line, libfile, &LineNum); if ( LibEntry ) { /* If we are here, this part is O.k. - put it in: */ ++*NumOfParts; PQInsert(&PQ, LibEntry); InsertAlias(&PQ, LibEntry, NumOfParts); } } } return PQ; }