示例#1
0
/**
 * Configures the incomplete log image
 * path. The path is completed in ROI class
 * that have the indexROI.
 */
void MetaInfo::setLogImageIncompletePath() {
//    this->logImageIncompletePath = ".." + LOG_IMAGES +
//            getPageName().replace(getPageName().size()-4, getPageName().size(), "");
    string page = getPageName().replace(getPageName().size()-4, getPageName().size(), "");
    string exp = "../experience";
    this->logImageIncompletePath = exp + getBookName() + page + page;
}
    bool CCSocialLikeGate::openInner() {
        if (canOpen()) {

            CCSoomlaProfile::getInstance()->like(getProvider(), getPageName()->getCString(), NULL, NULL);

            return true;
        }

        return false;
    }
示例#3
0
main(int argc, char** argv)
{
    char* cp;
    int npages, ok;
    struct stat sb;
    TIFF* tif;
    float vres, w, h;
    long pageWidth, pageLength;
    char sender[80];
    char date[80];
    struct pageSizeInfo* info;

    if (argc != 2) {
	fprintf(stderr, "usage: %s file.tif\n", argv[0]);
	exit(-1);
    }
    printf("%s:\n", argv[1]);
    TIFFSetErrorHandler(NULL);
    TIFFSetWarningHandler(NULL);
    tif = TIFFOpen(argv[1], "r");
    if (tif == NULL) {
	printf("Could not open (%s).\n", strerror(errno));
	exit(0);
    }
    ok = isFAXImage(tif);
    if (!ok) {
	printf("Does not look like a facsimile?\n");
	exit(0);
    }
    if (TIFFGetField(tif, TIFFTAG_IMAGEDESCRIPTION, &cp))
	sanitize(sender, cp, sizeof (sender));
    else
	strcpy(sender, "<unknown>");
    printf("%11s %s\n", "Sender:", sender);
    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &pageWidth);
    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &pageLength);
    if (TIFFGetField(tif, TIFFTAG_YRESOLUTION, &vres)) {
	short resunit = RESUNIT_NONE;
	TIFFGetField(tif, TIFFTAG_RESOLUTIONUNIT, &resunit);
	if (resunit == RESUNIT_CENTIMETER)
	    vres *= 25.4;
    } else
	vres = 98;
    npages = 0;
    do {
	npages++;
    } while (TIFFReadDirectory(tif));
    printf("%11s %u\n", "Pages:", npages);
    if (vres == 98)
	printf("%11s Normal\n", "Quality:");
    else if (vres == 196)
	printf("%11s Fine\n", "Quality:");
    else
	printf("%11s %.2f lines/inch\n", "Quality:", vres);
    h = pageLength / (vres < 100 ? 3.85 : 7.7);
    w = (pageWidth / 204.) * 25.4;
    info = closestPageSize(w, h);
    if (info)
	printf("%11s %s\n", "Page:", getPageName(info));
    else
	printf("%11s %lu by %lu\n", "Page:", pageWidth, pageLength);
    delPageSize(info);
    if (!TIFFGetField(tif, TIFFTAG_DATETIME, &cp)) {
	struct stat sb;
	fstat(TIFFFileno(tif), &sb);
	strftime(date, sizeof (date),
	    "%Y:%m:%d %H:%M:%S %Z", localtime(&sb.st_mtime));
    } else
	sanitize(date, cp, sizeof (date));
    printf("%11s %s\n", "Received:", date);
    exit(0);
}
std::string CCatPage::buildContent() const
{
	CTemplateHelper* templateManager = CTemplateHelper::getInstance();

	CDBManager* dbManager = CManagers::getInstance()->getDBManager();
	std::shared_ptr<CDBRequest> dbRequest(dbManager->createDBRequest());

	std::map<std::string, std::string> params;
	tmpString = "";

	const CUser* user = dynamic_cast<const CUser*>(currRequest->getUser());
	CConfigHelper* settingsManager = CConfigHelper::getInstance();

	const CHTMLTemplate* contentTemplate  = templateManager->findTemplate("content");
	if(contentTemplate == NULL) return "Missing content template";

	const CMenuCategory* currCategory = CMenu::getInstance()->findCategoryByName(getPageName());
	if(currCategory == NULL) return "Cant find this category";

	if(!user->getIsValid())return "User not valid";

	const std::vector<int> threadsId       = currCategory->getThreadsId(settingsManager->getIntParamValue("defaulThreadsCnt", 10));
	const std::vector<int>* fixedThreadsId = user->getFixedThreads();

	tmpString += "<input type='hidden' name='category_id' value='";
	tmpString += valueToString(currCategory->getId());
	tmpString += "' /> \n";

	tmpString += "<input type='hidden' name='return_page' value='";
	tmpString += getPageName();
	tmpString += "' /> \n" ;

	tmpString += "<h1>/";
	tmpString += htmlspecialchars(currCategory->getName());
	tmpString += "/ &mdash; ";
	tmpString += htmlspecialchars(currCategory->getDescription());
	tmpString += "</h1> \n";

	if(currCategory->getThreadCreationAccessLevel() <= user->getUserType(currCategory->getId()))
	{
		tmpString += buildNewThreadForm(getPageName(), currCategory->getId(), user);
		tmpString += "\n";
	}
	if(currCategory->getPostCreationAccessLevel() <= user->getUserType(currCategory->getId()))
	{
		tmpString += buildNewPostForm(getPageName(), user);
		tmpString += "\n";
	}

	// GLOBAL FIXED THREADS
	int threadsCnt = 0;
	int hiddenthreadsCnt = 0;

	const CDBRequestResult* result = dbRequest->selectRequest(CDBValues("id"),"Threads", "`threadCatId` = "+valueToString(currCategory->getId())+" AND `isFixed` = 1");
	if(dbRequest->getIsLastQuerySuccess() && result != NULL && result->getRowsCnt() > 0)
	{
		for(int i = 0; i < result->getRowsCnt(); i++)
		{
			int threadId = 0;
			threadId = result->getIntValue(i, 0);

			const CThread* currThread = new CThread(threadId);
			if(!currThread->getIsValid() || currThread->getIsHidden())
			{
				if(currThread->getIsHidden()) hiddenthreadsCnt++;
				delete currThread;
				continue;
			}
			threadsCnt++;
			tmpString += buildThread(currThread, user);
			tmpString += "\n";
			delete currThread;
		}
	}

	// USER FIXED THREADS
	for(unsigned int i = 0; i < fixedThreadsId->size(); i++)
	{
		const CThread* currThread = new CThread((*fixedThreadsId)[i]);
		if(!currThread->getIsValid() || currThread->getIsFixed() || currThread->getCatId() != currCategory->getId() || currThread->getIsHidden())
		{
			delete currThread;
			continue;
		}
		threadsCnt++;
		tmpString += buildThread(currThread, user);
		tmpString += "\n";
		delete currThread;
	}
	tmpString += "<br> \n";

	// ALL OTHER THREADS
	int minThreadPosition = INT_MAX;
	for(unsigned int i = 0; i < threadsId.size(); i++)
	{
		const CThread* currThread = new CThread(threadsId[i]);
		if(currThread->getIsValid() && currThread->getIsHidden() && !currThread->getIsFixed()) hiddenthreadsCnt++;
		if(!currThread->getIsValid() || user->getIsThreadFixed(threadsId[i]) || currThread->getIsFixed() || currThread->getIsHidden())
		{
			delete currThread;
			continue;
		}

		threadsCnt++;
		if(currThread->getPosition() < minThreadPosition) minThreadPosition = currThread->getPosition();
		tmpString += buildThread(currThread, user);
		tmpString += "\n";
		delete currThread;
	}

	tmpString += "<input type='hidden' name='all_threads_cnt' value='";
	tmpString += valueToString(currCategory->getAllThreadsCnt() - hiddenthreadsCnt);
	tmpString += "' /> \n";

	tmpString += "<input type='hidden' name='min_thread_pos' value='";
	tmpString += valueToString(minThreadPosition);
	tmpString += "' /> \n";

	tmpString += "<input type='hidden' id='thCnt' name='curr_threads_cnt' value='";
	tmpString += valueToString(threadsCnt);
	tmpString += "' /> \n";

	params["{LEFTPANEL}"] 	= buildLeftPanel(user);
	params["{UPMENU}"] 		= buildUpperMenu(user);
	params["{CONTENT}"] 	= tmpString;

	return contentTemplate->getHTMLData(&params);
}
示例#5
0
/**
 * Configures the output file path.
 */
void MetaInfo::setOutputFilePath() {
    this->outputFilePath = ".." + BOOKS + getBookName() + METADADOS + SAIDA + 
            getPageName().replace(getPageName().size()-4, getPageName().size(), ".txt");
    printf("output file path: %s\n", this->getOutputFilePath().c_str());
}
示例#6
0
/**
 * Configures the low resolution image path.
 */
void MetaInfo::setLowResolutionImagePath() {
    this->lowResolutionImagePath = ".." + BOOKS + getBookName() + BAIXA_RESOLUCAO + getPageName();
    printf("low path: %s\n", lowResolutionImagePath.c_str());
}
示例#7
0
/**
 * Configures the high resolution image path.
 */
void MetaInfo::setHighResolutionImagePath() {
    this->highResolutionImagePath = ".." + BOOKS + getBookName() + ALTA_RESOLUCAO + getPageName();
    printf("high path: %s\n", highResolutionImagePath.c_str());
}
示例#8
0
/**
 * Configures the incomplete path
 * to image cut, this path will be without
 * the index roi. The path is completed in ROI class
 * that have the indexROI.
 * 
 */
void MetaInfo::setHighResolutionImageCutIncompletePath() {
    this->highResolutionImageCutIncompletePath = ".." + BOOKS + getBookName() + METADADOS + TABELAS_ALTA + 
            getPageName().replace(getPageName().size()-4, getPageName().size(), "");
}