diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-05-29 13:33:52 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-05-29 13:33:52 -0400 |
commit | df7772e301be10fd31329f646db98361baa04857 (patch) | |
tree | d6cb1452e8ead9d3555dd7884220c417125f18c7 | |
parent | 63a97ff6fc313372d9cb439a621f12fdecc2fac1 (diff) | |
download | volse-hubzilla-df7772e301be10fd31329f646db98361baa04857.tar.gz volse-hubzilla-df7772e301be10fd31329f646db98361baa04857.tar.bz2 volse-hubzilla-df7772e301be10fd31329f646db98361baa04857.zip |
Home page create with new wiki. URL redirects here when no page given. Fixed bug with author in wiki item table record.
-rw-r--r-- | Zotlabs/Module/Wiki.php | 20 | ||||
-rw-r--r-- | view/tpl/wikilist.tpl | 2 |
2 files changed, 18 insertions, 4 deletions
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 70d326faf..51630bddc 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -52,7 +52,10 @@ class Wiki extends \Zotlabs\Web\Controller { $resource_id = ''; $pagename = ''; - if(argc()>2) { + + // GET https://hubzilla.hub/argv(0)/argv(1)/argv(2)/argv(3)/argv(4)/... + if(argc() > 2) { + // GET /wiki/channel/wiki // Check if wiki exists andr redirect if it does not $channel = get_channel_by_nick(argv(1)); $w = wiki_exists_by_name($channel['channel_id'], argv(2)); @@ -62,17 +65,23 @@ class Wiki extends \Zotlabs\Web\Controller { $resource_id = $w['resource_id']; } } + if(argc()<3) { + // GET /wiki/channel $wikiheader = t('Wiki Sandbox'); $content = '"# Wiki Sandbox\n\nContent you **edit** and **preview** here *will not be saved*."'; $hide_editor = false; $showPageControls = false; } elseif (argc()<4) { + // GET /wiki/channel/wiki + // No page was specified, so redirect to Home.md + goaway('/'.argv(0).'/'.argv(1).'/'.argv(2).'/Home.md'); $wikiheader = rawurldecode(argv(2)); // show wiki name $content = '""'; $hide_editor = true; $showPageControls = true; } elseif (argc()<5) { + // GET /wiki/channel/wiki/page $pagename = argv(3); $wikiheader = rawurldecode(argv(2)) . ': ' . rawurldecode($pagename); // show wiki name and page $p = wiki_get_page_content(array('wiki_resource_id' => $resource_id, 'page' => $pagename)); @@ -127,11 +136,11 @@ class Wiki extends \Zotlabs\Web\Controller { if ((argc() > 3) && (argv(2) === 'create') && (argv(3) === 'wiki')) { $which = argv(1); // Determine if observer has permission to create wiki + $observer_hash = get_observer_hash(); if (local_channel()) { $channel = \App::get_channel(); } else { $channel = get_channel_by_nick($which); - $observer_hash = get_observer_hash(); // Figure out who the page owner is. $perms = get_all_perms(intval($channel['channel_id']), $observer_hash); // TODO: Create a new permission setting for wiki analogous to webpages. Until @@ -151,7 +160,12 @@ class Wiki extends \Zotlabs\Web\Controller { $acl->set_from_array($_POST); $r = wiki_create_wiki($channel, $observer_hash, $name, $acl); if ($r['success']) { - goaway('/wiki/'.$which.'/'.$name); + $homePage = wiki_create_page('Home.md', $r['item']['resource_id']); + if(!$homePage['success']) { + notice('Wiki created, but error creating Home page.'); + goaway('/wiki/'.$which.'/'.$name); + } + goaway('/wiki/'.$which.'/'.$name.'/Home.md'); } else { notice('Error creating wiki'); goaway('/wiki'); diff --git a/view/tpl/wikilist.tpl b/view/tpl/wikilist.tpl index f3cea489d..d1652dcf4 100644 --- a/view/tpl/wikilist.tpl +++ b/view/tpl/wikilist.tpl @@ -7,7 +7,7 @@ <b>{{$wiki.title}}</b><b class="fa fa-caret-down pull-right"></b> </a> <ul class="dropdown-menu pull-right"> - <li><a href="/wiki/{{$channel}}/{{$wiki.title}}" title="View {{$wiki.title}}">View</a></li> + <li><a href="/wiki/{{$channel}}/{{$wiki.title}}/Home.md" title="View {{$wiki.title}}">View</a></li> <li class="divider"></li> <li><a href="#" onclick="wiki_delete_wiki('{{$wiki.title}}','{{$wiki.resource_id}}'); return false;" title="Delete {{$wiki.title}}">Delete wiki</a></li> </ul> |