예제 #1
0
파일: espRequest.c 프로젝트: armagardon/esp
/*
    Render a document by mapping a URL target to a document. The target is interpreted relative to route->documents.
    If target exists, then serve that.
    If target + extension exists, serve that.
    If target is a directory and an index.esp, return the index.esp without a redirect.
    If target is a directory without a trailing "/" but with an index.esp, do an external redirect to "URI/".
    If target does not end with ".esp", then do not serve that.
 */
PUBLIC void espRenderDocument(HttpConn *conn, cchar *target)
{
    HttpUri     *up;
    MprKey      *kp;
    cchar       *dest;

    assert(target);

    for (ITERATE_KEYS(conn->rx->route->extensions, kp)) {
        if (kp->key && *kp->key) {
            if ((dest = checkView(conn, target, 0, kp->key)) != 0) {
                espRenderView(conn, dest, 0);
                return;
            }
        }
    }
    if ((dest = checkView(conn, target, 0, "esp")) != 0) {
        espRenderView(conn, dest, 0);
        return;
    }
    if ((dest = checkView(conn, target, "index", "esp")) != 0) {
        /*
            Must do external redirect first if URL does not end with "/"
         */
        if (!sends(conn->rx->parsedUri->path, "/")) {
            up = conn->rx->parsedUri;
            httpRedirect(conn, HTTP_CODE_MOVED_PERMANENTLY, httpFormatUri(up->scheme, up->host,
                up->port, sjoin(up->path, "/", NULL), up->reference, up->query, 0));
            return;
        }
        espRenderView(conn, dest, 0);
        return;
    }
/* 
    Remove in version 6 
*/
#if DEPRECATED || 1
    if ((dest = checkView(conn, sjoin("app/", target, NULL), 0, "esp")) != 0) {
        espRenderView(conn, dest, 0);
        return;
    }
#endif
    /*
        Last chance, forward to the file handler ... not an ESP request. 
        This enables static file requests within ESP routes.
     */
    httpTrace(conn, "esp.handler", "context", "msg: 'Relay to the fileHandler");
    conn->rx->target = &conn->rx->pathInfo[1];
    httpMapFile(conn);
    if (conn->tx->fileInfo.isDir) {
        httpHandleDirectory(conn);
    }
    httpSetFileHandler(conn, 0);
}
예제 #2
0
void CreateCustomViewDialog::on_cbView_currentIndexChanged(int)
{
	const MetaClass *mc = ui->cbView->getSelected();
	if (mc) {
		GeoXView *testView = (GeoXView*)mc->newInstance();
		const MetaClass *canvasType = testView->preferredCanvasType();
		delete testView;
		ui->cbNewCanvas->setSelection(canvasType);
	}
	checkView();
}
예제 #3
0
void CreateCustomViewDialog::on_cbData_currentIndexChanged(int)
{
	int dataIndex = ui->cbData->currentIndex();
	if (dataIndex > -1) {
		string dataName = qString2STLString(ui->cbData->itemText(dataIndex));
		GeoXData *data = (GeoXData*)tmpWorkSpace->getData()->getObject(dataName);
		const MetaClass *mcv = data->getDefaultViewer();
		const MetaClass *mcc = data->getDefaultViewerDefaultCanvas();
		ui->cbView->setSelection(mcv);
		ui->cbNewCanvas->setSelection(mcc);
	}
	checkView();
}
예제 #4
0
void CreateCustomViewDialog::on_cbNewCanvas_currentIndexChanged(int)
{
	checkView();
}
예제 #5
0
void Character::setLookDir(int lookInt){
	lookDir = World::getDir(lookInt);
	model = CharacterModelContainer::open(gender, lookInt, index);
	checkView();
}