Namespace Papercube.viewController

Extends: SC.Object
Defined in: clients/papercube/controllers/view.js
Version: 1.0
Author: Peter Bergstrom
Copyright: 2008-2009 Peter Bergström.

Overview

This controller controls what view is currently being shown. There are two dimensions, the type of object being visualized (ie. Authors or Papers) and the type of view that we're showing (ie. CircleView or TreeView).

Property Summary

Method Summary

Property Details

_history [R/W]

History array.

+   Array _history

Discussion

Each item is saved in the following format:

{ guid: guid, type: type, label: label, viewChoice: this.get('viewChoice'), viewDirection: this.get('viewDirection'), viewingMode: this.get('viewingMode') }


_historyIdx [R/W]

The current index into the history array.

+   Integer _historyIdx


_saved [R/W]

Saved papers or authors.

+   Array _saved

Discussion

Saved documents are only per session at the moment.

Saved in the format:

{type: "Paper", guid: 'PAPER-1233'} {type: "Author", guid: 'AUTHOR-1233'}


_savedGuids [R/W]

The guids of the items saved.

+   Object _savedGuids

Discussion

This is kept around so that things aren't saved more than once.


_timer [R/W]

The timer for the back button.

+   Object _timer


_viewVisibilities [R/W]

Visibilty relation hash.

+   Object _viewVisibilities


authorForView [R/W]

This is the content that you set that your views listen to.

+   Author authorForView


authorPaperViewShowing [R/W]

authorPaperView's visibility.

+   Boolean authorPaperViewShowing

Default Value: NO

Discussion

Author view.


authorStatViewShowing [R/W]

authorStatView's visibility.

+   Boolean authorStatViewShowing

Default Value: NO

Discussion

Author view.


authorViewChoice [R/W]

Default authorViewChoice is 'Author Detail'.

+   String authorViewChoice

Default Value: 'Author Detail'


circleViewShowing [R/W]

circleView's visibility.

+   Boolean circleViewShowing

Default Value: NO

Discussion

Paper view.


citeRefViewShowing [R/W]

citeRefView's visibility.

+   Boolean citeRefViewShowing

Default Value: NO

Discussion

Author view.


collaboratorViewShowing [R/W]

collaboratorView's visibility.

+   Boolean collaboratorViewShowing

Default Value: NO

Discussion

Author view.


contentForView [R/W]

This is the type agnostic param that is used for saving.

+   Record contentForView


noContentForView [R/W]

This is the type agnostic param that is used for saving.

+   Boolean noContentForView

Discussion

True if there is no content set yet. If YES, the empty view is shown.


nowShowing [R/W]

Now showing property for the tab view.

+   String nowShowing

Default Value: 'noContent'


paperForView [R/W]

This is the content that you set that your views listen to.

+   Paper paperForView


paperGraphViewShowing [R/W]

paperGraphView's visibility.

+   Boolean paperGraphViewShowing

Default Value: NO

Discussion

Paper view.


papersPerYearViewShowing [R/W]

papersPerYearView's visibility.

+   Boolean papersPerYearViewShowing

Default Value: NO

Discussion

Paper view.


paperStatViewShowing [R/W]

paperStatView's visibility.

+   Boolean paperStatViewShowing

Default Value: NO

Discussion

Paper view.


paperTreeViewShowing [R/W]

paperTreeView's visibility.

+   Boolean paperTreeViewShowing

Default Value: NO

Discussion

Paper view.


paperViewChoice [R/W]

Default paperViewChoice is 'Paper Detail'.

+   String paperViewChoice

Default Value: 'Paper Detail'


savedContent [R/W]

The content array for the savedPanelView.

+   Array savedContent


savedPanelViewShowing [R/W]

savedPanelView's visibility.

+   Boolean savedPanelViewShowing

Default Value: NO


shouldNotShowAgain [R/W]

Checkbox value.

+   Boolean shouldNotShowAgain

Default Value: YES

Discussion

Default YES so that it never is shown again.


showIntroView [R/W]

The intro view visibility.

+   Boolean showIntroView

Default Value: NO


viewChoice [R/W]

Default viewChoice is 'Paper Detail'.

+   String viewChoice

Default Value: 'Paper Detail'


viewChoices [R/W]

Available views for viewing modes.

+   Object viewChoices


viewDirection [R/W]

Default view direction.

+   String viewDirection

Default Value: 'References'


viewDirectionChoices [R/W]

Available view directions.

+   Array viewDirectionChoices


viewingMode [R/W]

Default viewing mode is Papers.

+   String viewingMode

Default Value: 'Papers'


viewingModes [R/W]

Available viewing modes.

+   Array viewingModes


Method Detail

_setHistoryLocation()

Set the location.

+   (void) _setHistoryLocation ()


_showHistoryItem()

Show an item in the history based on the index passed in.

+   (void) _showHistoryItem (idx)

Parameters

idx {Integer} The index to go to.

Discussion

Read in the history item and set back all the parameters saved.


addToHistory()

Add to the history.

+   (void) addToHistory (guid, type, label)

Parameters

guid {Integer} The item's guid.

type {string} The item's content type.

label {string} The label of the item.


checkLocation()

Check for location change and then chang it.

+   (void) checkLocation ()


clearSaved()

Clear the saved items array and cookie.

+   (void) clearSaved ()


collectNeededPaperGUIDs()

Collect the guids needed to be retrieved for a given view.

+   (Array) collectNeededPaperGUIDs (rel, guids)

Parameters

rel {string} The paper guid relation array.

guids {Array} Array of needed guids.

Returns

(Array) {object} Returns a hash containing papers that exist and guids that need to be retrieved.


hideSaved()

Hide the savedPanelView.

+   (void) hideSaved ()


hideVideo()

Hide the video and write the cookie if needed.

+   (void) hideVideo ()


noContentForViewDidChange()

If the contentForView is not null, set noContentForView to YES.

+   (void) noContentForViewDidChange ()

Observes

contentForView


readSavedItemsCookie()

Read the saved items from the 'papercube' cookie.

+   (Boolean) readSavedItemsCookie ()

Returns

(Boolean) Returns NO if there is an error.

Discussion

Save the items to the _saved and _savedGuids arrays.


saveObject()

Given the guid and contnet type of an item, save it.

+   (void) saveObject (guid, type)

Parameters

guid {Integer} The item's guid.

type {string} The item's content type.


setContentToView()

Set the content for the view.

+   (void) setContentToView (content, fromHistory)

Parameters

content {Record} The content object. Either an Author or Paper.

fromHistory {boolean} True if the view direction is set from a history action.


setContentToViewFromGUID()

Set the content for the view form a guid.

+   (void) setContentToViewFromGUID (guid, type, fromHistory)

Parameters

guid {string} The guid of the content that you want to pass to setContentToView.

type {string} The type of the content. Either 'Author' or 'Paper'.

fromHistory {boolean} True if the view direction is set from a history action.


setViewChoice()

Change views.

+   (Boolean) setViewChoice (viewChoice, fromHistory)

Parameters

viewChoice {string} the view choice.

fromHistory {boolean} True if the view direction is set from a history action.

Returns

(Boolean) Returns NO if there is a error.


setViewDirection()

Change viewing direction.

+   (void) setViewDirection (direction, fromHistory)

Parameters

direction {string} the view direction.

fromHistory {boolean} True if the view direction is set from a history action.


setViewingMode()

Set the viewing mode.

+   (Boolean) setViewingMode (viewMode, fromHistory)

Parameters

viewMode {string} the view mode.

fromHistory {boolean} True if the view direction is set from a history action.

Returns

(Boolean) Returns NO if there is a error.


showDefaultView()

Load default view.

+   (void) showDefaultView ()


showSaved()

Show the savedPanelView.

+   (void) showSaved ()

Discussion

Look at the saved item guids and find the content from the store.


showVideo()

Show the video if the cookie is not written.

+   (void) showVideo ()


viewAuthor()

View an author.

+   (void) viewAuthor (guid)

Parameters

guid {string} The guid of the content that you want to pass to setContentToView.


viewPaper()

View an paper.

+   (void) viewPaper (guid)

Parameters

guid {string} The guid of the content that you want to pass to setContentToView.


Documentation generated by JsDoc Toolkit 2.0.2 on Sat Nov 21 2009 21:24:39 GMT-0800 (PST)