This commit is contained in:
Joey Kimsey
2024-12-24 22:15:01 -05:00
parent f8e75e847d
commit 900ca8a691
110 changed files with 1065 additions and 113 deletions

View File

@ -70,6 +70,22 @@ class Bookmarks extends Controller {
$this->setPrefToggles();
}
public function tutorials( $browser = '', $tutorial = '' ) {
self::$title = 'Tutorials - {SITENAME}';
if ( empty( $browser ) && empty( $tutorial ) ) {
return Views::view( 'bookmarks.tutorials.list' );
}
if ( ! in_array( $browser, ['chrome','brave','firefox','edge','safari','opera'] ) ) {
Issues::add( 'error', 'Unknown browser' );
return Views::view( 'bookmarks.tutorials.list' );
}
if ( ! in_array( $tutorial, ['pin','settings','import','export'] ) ) {
Issues::add( 'error', 'Unknown tutorial' );
return Views::view( 'bookmarks.tutorials.list' );
}
return Views::view( 'bookmarks.tutorials.' . $browser . '.' . $tutorial );
}
public function index() {
self::$title = 'Manage Bookmarks - {SITENAME}';
if ( Input::exists('submit') ) {
@ -95,8 +111,11 @@ class Bookmarks extends Controller {
$panelArray[] = $folderObject;
}
}
Components::set( 'folderPanels', Views::simpleView( 'bookmarks.components.bookmarkListPanel', $panelArray ) );
return Views::view( 'bookmarks.dash' );
if ( ! empty( $folders ) ) {
Components::set( 'folderPanels', Views::simpleView( 'bookmarks.components.bookmarkListPanel', $panelArray ) );
return Views::view( 'bookmarks.dash' );
}
return Views::view( 'bookmarks.indexExplainer' );
}
/**
@ -564,9 +583,10 @@ class Bookmarks extends Controller {
public function dashboards() {
self::$title = 'Bookmark Dashboards - {SITENAME}';
if ( !App::$isMember ) {
Issues::add( 'notice', 'You must have an active membership to manage dashboards.' );
return $this->index();
Issues::add( 'notice', 'You will need an active subscription to start creating dashboards. You can check our <a href="/member/join">Pricing</a> page for more details.' );
return Views::view( 'bookmarks.dashboardExplainer' );
}
$dashboards = self::$dashboards->byUser();
return Views::view( 'bookmarks.dashboards.list', $dashboards );
@ -687,8 +707,8 @@ class Bookmarks extends Controller {
public function import() {
self::$title = 'Bookmark Import - {SITENAME}';
if ( !App::$isMember ) {
Issues::add( 'notice', 'You must have an active membership to import bookmarks.' );
return $this->index();
Issues::add( 'notice', 'You will need an active subscription to start importing bookmarks. You can check our <a href="/member/join">Pricing</a> page for more details.' );
return Views::view( 'bookmarks.importExplainer' );
}
if ( ! Input::exists('submit') ) {
@ -739,8 +759,8 @@ class Bookmarks extends Controller {
public function export() {
self::$title = 'Bookmark Export - {SITENAME}';
if ( !App::$isMember ) {
Issues::add( 'notice', 'You must have an active membership to export bookmarks.' );
return $this->index();
Issues::add( 'notice', 'You will need an active subscription to start exporting bookmarks. You can check our <a href="/member/join">Pricing</a> page for more details.' );
return Views::view( 'bookmarks.exportExplainer' );
}
$folders = self::$folders->byUser();
@ -806,7 +826,7 @@ class Bookmarks extends Controller {
$panelArray = [];
$folders = self::$folders->byUser();
if ( empty( $folders ) ) {
return Views::view( 'bookmarks.share' );
return Views::view( 'bookmarks.shareExplainer' );
}
foreach ( $folders as $key => $folder ) {
$panel = new \stdClass();
@ -924,13 +944,17 @@ class Bookmarks extends Controller {
}
$options = $assocOptions;
}
foreach ( $options as $fieldname => $value ) {
if ( $folderID == $value ) {
$selected = ' selected';
} else {
$selected = '';
if ( ! empty( $options ) ) {
foreach ( $options as $fieldname => $value ) {
if ( $folderID == $value ) {
$selected = ' selected';
} else {
$selected = '';
}
$out .= '<option value="' . $value . '"' . $selected . '>' . $fieldname . '</option>';
}
$out .= '<option value="' . $value . '"' . $selected . '>' . $fieldname . '</option>';
} else {
$out .= '<option value="0" selected>No Folder</option>';
}
$out .= '</select>';
$out .= '</div>';