public function createInstanceByCode($selfedit = "false", $instanceName=null) {
        if (!$instanceName) {
            $this->newInstanceByCallback();
            return;
        }

        $this->selfedit = $selfedit;

        if ($selfedit == "true") {
            $this->moufManager = MoufManager::getMoufManager();
        } else {
            $this->moufManager = MoufManager::getMoufManagerHiddenInstance();
        }

        $this->moufManager->createInstanceByCode()->setName($instanceName);
        $this->moufManager->rewriteMouf();
        header("Location: ".MOUF_URL."ajaxinstance/?name=".urlencode($instanceName)."&selfedit=".$selfedit);
    }