示例#1
0
void
CfHandler::check()
{
    if (_subscriber.nextConfig(0)) {
        doConfigure();
    }
}
    void PropertyConfiguratorImpl::doConfigure(const std::string& initFileName) throw (ConfigureFailure) {
        std::ifstream initFile(initFileName.c_str());

        if (!initFile) {
            throw ConfigureFailure(std::string("File ") + initFileName + " does not exist");
        }

        doConfigure(initFile);
    }
示例#3
0
文件: configure.c 项目: bowhan/kent
void doDefaultConfigure(struct sqlConnection *conn, struct column *colList)
/* Do configuration starting with defaults. */
{
struct column *col;
for (col=colList; col != NULL; col = col->next)
    col->on = col->defaultOn;
cartRemovePrefix(cart, colConfigPrefix);
cartRemove(cart, colOrderVar);
//restoreDefaultOrder(&colList);
doConfigure(conn, colList); //, NULL);
}
示例#4
0
  Component* ComponentFactory::create(const tnt::Compident& ci,
    const tnt::Urlmapper& um, tnt::Comploader& cl)
  {
    if (theComponent == 0)
    {
      doConfigure(TntConfig::it());
      theComponent = doCreate(ci, um, cl);
    }

    return theComponent;
  }
示例#5
0
文件: configure.c 项目: bowhan/kent
static void  configAllVis(struct sqlConnection *conn, struct column *colList,
        boolean how)
/* Respond to hide all button in configuration page. */
{
char varName[64];
struct column *col;
for (col = colList; col != NULL; col = col->next)
    {
    safef(varName, sizeof(varName), "%s%s.vis", colConfigPrefix, col->name);
    cartSetBoolean(cart, varName, how);
    }
doConfigure(conn, colList); //, NULL);
}
示例#6
0
void doMiddle(struct cart *theCart)
/* Write the middle parts of the HTML page.
 * This routine sets up some globals and then
 * dispatches to the appropriate page-maker. */
{
cart = theCart;

if (hIsGisaidServer())
    {
    validateGisaidUser(cart);
    }

if (cartVarExists(cart, confVarName))
    doConfigure(conn, colList);
else if (cartVarExists(cart, defaultConfName))
    doDefaultConfigure(conn, colList);
else if (cartVarExists(cart, hideAllConfName))
    doConfigHideAll(conn, colList);
else if (cartVarExists(cart, showAllConfName))
    doConfigShowAll(conn, colList);

else if (cartVarExists(cart, getSeqPageVarName))
    doGetSeqPage(conn, colList);

else if (cartVarExists(cart, advFilterVarName))
    doAdvFilter(conn, colList);
else if (cartVarExists(cart, advFilterClearVarName))
    doAdvFilterClear(conn, colList);

else if ((col = advFilterKeyPastePressed(colList)) != NULL)
    doAdvFilterKeyPaste(conn, colList, col);
else if ((col = advFilterKeyPastedPressed(colList)) != NULL)
    doAdvFilterKeyPasted(conn, colList, col);
else if ((col = advFilterKeyUploadPressed(colList)) != NULL)
    doAdvFilterKeyUpload(conn, colList, col);
else if ((col = advFilterKeyClearPressed(colList)) != NULL)
    doAdvFilterKeyClear(conn, colList, col);
else
    displayData(conn, colList);

cartRemovePrefix(cart, "gisaidTable.do.");

}
示例#7
0
void displayData(struct sqlConnection *conn, struct column *colList)
/* Display data in neighborhood of gene. */
{
struct subjInfo *subjList = NULL;
struct column *ordList = colList;
struct column *ord = curOrder(ordList);

if (ord == NULL)  /* no columns are visible, go to back to configure page */
    {
    doConfigure(conn, colList);
    return;
    }


if (cartVarExists(cart, getTextVarName))
    {
    subjList = getOrderedList(ord, colList, conn, BIGNUM);
    doGetText(conn, colList, subjList);
    }
else if (cartVarExists(cart, getSeqVarName))
    {
    subjList = getOrderedList(ord, colList, conn, BIGNUM);
    doGetSeq(conn, subjList, cartString(cart, getSeqHowVarName));
    }
else if (cartVarExists(cart, redirectName))
    {
    subjList = getOrderedList(ord, colList, conn, BIGNUM);
    if (subjList)
	{
    	cartRemove(cart, redirectName);
	}
    else  /* if everything has been filtered out, we'll have to go back */
	{
	hPrintf("No subject(s) found with the filtering conditions specified.<br>");
	hPrintf("Click <a href=\"gisaidTable?gisaidTable.do.advFilter=filter+%c28now+on%c29\">here</a> to return to Select Subjects.<br>", '%', '%');
	}
    }
else
    {
    subjList = getOrderedList(ord, colList, conn, displayCount);
    doMainDisplay(conn, colList, subjList);
    }
}
    void GlobalConfiguration::configure(const Configuration::Ptr& configuration)
    {
        _configuration = configuration;

        logging.device = _configuration->get("logging.device", "None");
        logging.separator = " " + _configuration->get("logging.separator", "|") + " ";
        logging.escape_newline = _configuration->get("logging.escape_newline", false);

        debug.global_level = _configuration->get("debug.global_level", 0);
        if(_configuration->hasProperty("debug.level")) {
            StringVector properties;
            _configuration->getProperties("debug.level", properties);
            for(auto& property : properties) {
                debug.level.insert(std::make_pair(property, _configuration->get<int32_t>("debug.level." + property)));
            }
        }

        doConfigure(_configuration);
    }
示例#9
0
bool CrossRefPlugin::resolve (Document &doc)
{
	/*
	 * Prompt for username and password if needed
	 */
	if (_global_prefs->getCrossRefUsername ().empty ()) {
		Glib::ustring message = 
			String::ucompose (
				"<b><big>%1</big></b>\n\n%2\n",
				_("CrossRef credentials not found"),
				_("To use the CrossRef service, a free account is needed.  "
				  "Login information may be set in Preferences, or the CrossRef plugin "
				  "may be disabled.")
				);

		Gtk::MessageDialog dialog(message, true, Gtk::MESSAGE_WARNING,
				          Gtk::BUTTONS_NONE, true);

		dialog.add_button (Gtk::Stock::CANCEL,     0);
		dialog.add_button (_("_Preferences"),      1);
		dialog.add_button (_("_Disable CrossRef"), 2);

		do {
			int response = dialog.run ();
			if (response == 1) {
				// Preferences
				doConfigure ();
				if (!_global_prefs->getCrossRefUsername ().empty ())
					break;
				// if they didn't give us one then we loop around
				// else we go ahead
			} else if (response == 2) {
				// Disable
				_global_prefs->disablePlugin (this);
				return false;
			} else {
				// Cancel
				return false;
			}
		} while (1);
	}

	Glib::ustring messagetext =
		String::ucompose (
			"<b><big>%1</big></b>\n\n%2\n",
			_("Downloading metadata"),
			String::ucompose (
				_("Contacting crossref.org to retrieve metadata for '%1'"),
				doc.getField("doi"))
		);

	Glib::ustring const username = _global_prefs->getCrossRefUsername ();
	Glib::ustring const password = _global_prefs->getCrossRefPassword ();

	Glib::ustring const url = 
		  Glib::ustring("http://www.crossref.org/openurl/?pid=")
		+ username
		+ (password.empty() ? "" : ":")
		+ password 
		+ Glib::ustring("&id=doi:")
		+ Gnome::Vfs::escape_string(doc.getField("doi"))
		+ Glib::ustring ("&noredirect=true");

	DEBUG ("CrossRefPlugin::resolve: using url '%1'", url);

	// FIXME: even if we don't get any metadata, 
	// an exceptionless download+parse is considered
	// a success.
	// Nobody notices as long as crossref is the last resort
	bool success = true;

	try {
		Glib::ustring &xml = Transfer::readRemoteFile (
			_("Downloading Metadata"), messagetext, url);

		DEBUG (xml);

		// XXX
		// Test for "Missing WWW-Authenticate header" for bad username/password
		// Test for "No DOI found" for bad DOI

		CrossRefParser parser (doc.getBibData());
		Glib::Markup::ParseContext context (parser);
		try {
			context.parse (xml);
			context.end_parse ();
		} catch (Glib::MarkupError const ex) {
			DEBUG ("Markuperror while parsing:\n'''%1\n'''", xml);
			//Utility::exceptionDialog (&ex, _("Parsing CrossRef XML.  The DOI could be invalid, or not known to crossref.org"));
			success = false;
		}
	} catch (Transfer::Exception ex) {
		//Utility::exceptionDialog (&ex, _("Downloading metadata"));
		success = false;
	}

	DEBUG ("resolve returning %1", success);
	return success;
}