OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)

This commit is contained in:
wangruiguo
2026-09-03 18:49:20 +08:00
commit d647428529
3501 changed files with 1988906 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
<?php
namespace Leantime\Domain\Wiki\Controllers;
use Illuminate\Contracts\Container\BindingResolutionException;
use Leantime\Core\Auth\Permissions\RequiresPermission;
use Leantime\Core\Controller\Controller;
use Leantime\Core\Controller\Frontcontroller;
use Leantime\Domain\Wiki\Models\Wiki;
use Leantime\Domain\Wiki\Permissions\WikiPermissions;
use Leantime\Domain\Wiki\Services\Wiki as WikiService;
use Symfony\Component\HttpFoundation\Response;
class WikiModal extends Controller
{
private WikiService $wikiService;
public function init(WikiService $wikiService): void
{
$this->wikiService = $wikiService;
}
/**
* @throws BindingResolutionException
*/
#[RequiresPermission(WikiPermissions::VIEW)]
public function get($params): Response
{
$wiki = app()->make(Wiki::class);
if (isset($_GET['id'])) {
$wiki = $this->wikiService->getWiki($_GET['id']);
}
$this->tpl->assign('wiki', $wiki);
return $this->tpl->displayPartial('wiki.wikiDialog');
}
/**
* Creates or updates a wiki (notebook). The controller gate defers (entityScoped) to the
* service's createWiki/updateWiki, which authorize CREATE/EDIT against the wiki's real project.
*
* @throws BindingResolutionException
*/
#[RequiresPermission(WikiPermissions::EDIT, entityScoped: true)]
public function post($params): Response
{
$wiki = app()->make(Wiki::class);
if (isset($_GET['id'])) {
$id = (int) $_GET['id'];
// Update
$wiki->title = $params['title'];
$this->wikiService->updateWiki($wiki, $id);
$this->tpl->setNotification('notification.wiki_updated_successfully', 'success', 'wiki_updated');
return Frontcontroller::redirect(BASE_URL.'/wiki/wikiModal/'.$id);
} else {
// New
$wiki->title = $params['title'];
$wiki->projectId = session('currentProject');
$wiki->author = session('userdata.id');
$id = $this->wikiService->createWiki($wiki);
// session(["currentWiki" => $id]);
if ($id) {
$this->tpl->setNotification('notification.wiki_created_successfully', 'success', 'wiki_created');
return Frontcontroller::redirect(BASE_URL.'/wiki/wikiModal/'.$id.'?closeModal=1');
}
return Frontcontroller::redirect(BASE_URL.'/wiki/wikiModal/'.$id.'');
}
}
}