joomla-projects / gsoc16_shareable-draft-content

Shareable Draft Content
https://summerofcode.withgoogle.com/projects/#5268339920207872
GNU General Public License v2.0
4 stars 2 forks source link

share token generation #12

Closed nikitadhiman closed 8 years ago

nikitadhiman commented 8 years ago

Pull Request is for creation of a share token and storing that token in the #__share_draft database.

Summary of Changes:

  1. A new button is created for 'share', this button would be visible only when article is saved and is placed next to version button.
  2. A function shareTokenGenerate() and shareDraft() are created in the controller, shareTokenGenerate() will generate a random token containing a-z,A-Z and 0-9 but no special characters.
  3. In model file, query has been made to store this token in the database.

Testing Instruction:

  1. Apply the patch, make sure that the #__share_draft db exists.
  2. create a new article and save the article. 3.Once saved, hit share button, the values that should be stored the db are articleId, title of the article and newly generated random token.

Test 1 results:

  1. Button is visible once the article is saved.
  2. The values stored are (22,'first article','a16bdkAGjnd8')......Token Saved
roland-d commented 8 years ago

@nikitadhiman Looks like you still haven't set up code style. Travis reports errors:

FILE: ...ft-content/administrator/components/com_content/controllers/article.php


FOUND 2 ERROR(S) AFFECTING 2 LINE(S)


147 | ERROR | You must use "/**" style comments for a function comment

155 | ERROR | Missing function doc comment


UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY


FILE: ...e-draft-content/administrator/components/com_content/models/article.php


FOUND 2 ERROR(S) AFFECTING 2 LINE(S)


708 | ERROR | You must use "/**" style comments for a function comment

711 | ERROR | Please start your comment with a capital letter; found "//

 |       | perform whatever you want on each item checked in the list"

UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY


FILE: ...ontent/administrator/components/com_content/views/article/view.html.php


FOUND 1 ERROR(S) AFFECTING 1 LINE(S)


130 | ERROR | No space found after comma in function call


UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY


roland-d commented 8 years ago

@nikitadhiman Are you going to fix these issues?

nikitadhiman commented 8 years ago

@roland-d , on it....will ping you when done

roland-d commented 8 years ago

@nikitadhiman Travis failed with the following issues: FILE: ...ft-content/administrator/components/com_content/controllers/article.php


FOUND 1 ERROR(S) AFFECTING 1 LINE(S)


150 | ERROR | Superfluous doc comment at position 1


UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY


FILE: ...e-draft-content/administrator/components/com_content/models/article.php


FOUND 11 ERROR(S) AFFECTING 10 LINE(S)


572 | ERROR | Expected "if (...)\n...{...}\n...else\n"; found "if

 |       | (...)\n...{...}\n...else "

574 | ERROR | Expected "if (...)\n...{...}\n...else\n"; found "if

 |       | (...)\n...{...}\n...else "

587 | ERROR | Expected "if (...)\n...{...}\n...else\n"; found "if

 |       | (...)\n...{...}\n...else "

595 | ERROR | Expected "if (...)\n...{...}\n...else\n"; found "if

 |       | (...)\n...{...}\n...else "

602 | ERROR | Expected "if (...)\n...{...}\n...else\n"; found "if

 |       | (...)\n...{...}\n...else "

605 | ERROR | Expected "if (...)\n...{...}\n...else\n"; found "if

 |       | (...)\n...{...}\n...else "

627 | ERROR | Cast statements must be followed by a single space; expected

 |       | "(array) $pks" but found "(array)$pks"

630 | ERROR | Expected "if (...)\n...{...}\n...else\n"; found "if

 |       | (...)\n...{...}\n...else "

644 | ERROR | Cast statements must be followed by a single space; expected

 |       | "(int) $value" but found "(int)$value"

649 | ERROR | Expected "if (...)\n...{...}\n...else\n"; found "if

 |       | (...)\n...{...} ...else "

649 | ERROR | Cast statements must be followed by a single space; expected

 |       | "(int) $value" but found "(int)$value"

UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY


roland-d commented 8 years ago

Closing this in favor of #13 because this one is based on the wrong branch.