Drupal
Services Views module is very easiest and effective way to make web service in drupal. It creates view based resource to display service output in a view. It executes any view via calling the view resource created by view's service.
Create web service using views by following steps:
1. Download and install Views module (7.x-3.x or later).
2. Download and install Services module (7.x-3.x or later), enable services and rest_server module.
3. Download and install CTools module.
4. Download and install Services Views module.
5. Under admin -> Structure -> Services, Create Endpoint, enter Endpoint name, select server as REST server, enter Endpoint path and save it.
6. Now edit the Endpoint and under Server tab, select Reponse Formatter and Request Parsing.
7. Create a view:
- Enter view name lets say it "Services", select show "Content" and type of "your content type" for which content should be displyed, select sorting crieteria as per your requirement.
- Create a page, enter the path let's say "services_content" that will be your resource under your Endpoint. Now select fileds, filters as per your requirement.
8. Under admin -> Structure -> Services, Edit your Endpoint and enable the resource created in views.
Now, you can access resource like:
http://yoursitename.com/yourEndPointPath/services_content - Here services_content is your resource name i.e. path given in views.
9. You can also create the exposed filters and pass them in resource as a query string. For example, your exposed filter is tag, then you can access the resource like:
http://yoursitename.com/yourEndPointPath/services_content?tag=5
Cheers!!!
GeShi Filter provides a filter for source code syntax highlighting for various languages in any posts, for example in Blog Post.
I got TinyMCE WYSIWYG to work with GESHI filter using the following steps:
1. Download and install WYSIWYG module.
2. Download TinyMCE into sites/all/libraries.
3. Download and install WYSIWYG Filter module.
4. Created a new Text Format with the name "WYSIWYG Filter".
Enabled the following under Enabled Filters and put them in the filter processing order as listed below:
- WYSIWYG Filter
- Encode email addresses: Javascript-wrapped HTML entities
- Encode email addresses: HTML entities
- Convert URLs into links
- Correct faulty and chopped off HTML
- GeSHi filter
- Convert line breaks into HTML
For Filter Settings: Under WYSIWYG Filter, I added the tags GESHI to the HTML elements and attributes i.e. php as I need php code to be highlighted.
5. In WYSIWYG Profiles I set text format Editor as TinyMCE. To configure it, edit it and under "Cleanup and Output" I disabled everything except Apply Source formatting.
6. Left defaults for GESHI configuration (no line numbers)
7. Now to use the syntax highlighting in a textarea with WYSIWYG:
- Disable rich text-format
- Enter in <php>your code here</php> wherever you need it
- Re-enable rich text format and continue using WYSIWYG
I recognized that all HTML correction from TinyMCE WYSIWYG profile under Cleanup and output needs to be disabled to keep php tag and replace it with p tag, else it was not working for me, the php tag displayed as it is.
Also, under the WYSIWYG Filter, in the filter processing order, it was necessary to keep GeShi filter before the convert line breaks into HTML, else br tag was ended up throughtout the PHP code.
Cheers!!!
Druproid is an Android application which enables user to access Drupal admin panel to manage contents, users, taxonomy(Drupal 6), backup and migrate database, site configuration, reports etc for Drupal 6 and 7.
1. Drupal 6 : Download services_extra module from https://github.com/yarrait/services_extra
Drupal 7 : Download services_extra7 module from
https://github.com/yarrait/services_extra7
2. Extract the folder into sites/all/module/custom and rename the folder name services_extra-master to services_extra.
This module configure all the settings of the services module like endpoint sets as default “druproid”, server is “rest server” and enable all resources of services and services_extra module.
3. Download/Enable all dependencies of services_extra module.
Drupal 6
- services : https://github.com/yarrait/Services
- features : https://drupal.org/project/features (Download the Recommended version)
Drupa 7
-
services : https://drupal.org/project/services
-
features : https://drupal.org/project/features (Download the Recommended version)
-
ctools : https://drupal.org/project/ctools (Download the Recommended version)
4. Additional functionality
-
Backup and Migrate, download the module backup_migrate from https://drupal.org/project/backup_migrate
-
Push Notification, download the module druproid_notification from https://github.com/yarrait/druproid_notifications (drupal 7 only)
To Download the Druproid Installation Guide Click Here.
Outcome required was: Once checkout process gets completed User should get the access of perticular book for which he/she has ordered.
Best help I got is from the http://commerceguys.com/blog/selling-node-access-drupal-commerce which sells the Node and I had to sell the whole Book(bunch of nodes).
Initially I went with the flow of the above link of commerceguys and I could achieve exactly what they have mentioned in their tutorial.
This was the positive sign for me that I am going on the right path through which I will be able to get the exact result what I want.But what happens in the above tutorial is they only sell a node and not the whole book.You can say a bunch of nodes together.
And for Selling all nodes together issue I got help from the module https://drupal.org/project/node_access_book.Which resolved my issue completely and helped me to get the behavior what I wanted.
Step By Step process how I got this working.
You can watch the tutorial(http://commerceguys.com/blog/selling-node-access-drupal-commerce) which will give you 60% of the things working.
==>Before Starting go to /admin/people/permissions/roles and Create a new role called "Subscribed".
1) We have Content Access and its submodule Content Access Rules enabled.
Also download and enable node_access_book module.
We need 3 things:
a) Product Display
b) Products
c) Book Page
2) Enable book module.
3) Create a content type called Product display.
4) Go to store->products->Product types and go to manage fields of "products".
** Do not forget to do this ** :
go to content type-> Book Page-> Access Control.
Remove all the access from every user except for the admin and select the checkbox for "Enable per content node access control settings".
Basically we need a page which refers to the Store Product & Store Product should refer to a book's Parent Node.
For this,
5) Go to Content type->Product display & create a field "Product reference"(You can use any name), Field type "Product reference" and widget "Select List".(Keep Number of Values 1 only).
6) Go to store->products->Product types->Products->Manage Fields & create a field "Premium Node"(You can use any name), Field type "Node reference" and widget "Checkbox/Radio".
--> Select "Book Page" for Content types that can be referenced & Keep Number of Values 1 only.
Now, We need to set the Rules.(We will Create Two Rules)
Rule.1)
7) Go to Config->Rules and Add new Rule.
Name : Change the Order Status on Order Completion (You can use any name).
Tags : Not Required.
React on Event : Completing the checkout process
Click on "Save".
8) No need of giving any conditions.
In the Actions,click on "+ Add Loop" and you should be getting "commerce-order:commerce-line-items",just after that in "Variable label *" type "Line Item" & in "Variable name *" type "line_item".
Click on "Save".
Loop will check all the line Items available in the perticular order but what should be done in the action when it enters into the loop will be done in the Components.
9) Go to Config->Rules->components and Add new Component.
Select "Rule" and Click on "Continue".
Name: Component to Change Order Status (You can use any name).
Below you can see the table.
--Data Type : Commerce Line Item
--Label : Line Item
--Machine Name : line_item
Click on "Save Changes".
10) Conditions(2 conditions needs to be added):
--1) Click on "+ Add Condition" and select "Entity has Field", Data Selector: line-item , Field Value: commerce_product and click on "Save".
--2) Click on "+ Add Condition" and select "Entity has Field", Data Selector: line-item:commerce_product , Field Value: field_premium_node and click on "Save".
NOTE: field_premium_node is the field which is in Store->product types->products and which refers to the book's parent node.So select the field which is showing in your Products Manage fields and saved as Node Reference.
11) Actions:
--1) Click on "+ Add Action" and select "Add user role", Data Selector: site:current-user , Roles Value: Subscribed and click on "Save".
--2) Click on "+ Add Action" and select "Update the order status", Data Selector: line-item:order , Order Status Value: Completed and click on "Save".
Now the order Status will be updated to "Completed" state and we can now set the permission to the node referenced by the Product Node.
13) Go to rule you just created now.where the Loop was added in action.Click on "add action" which is next to Loop and select "The_component_you_just_created" in Select the action to add and click on "Save".
Fig: Rule1.
Fig: Component For Rule1.
Rule.2)
14) Go to Config->Rules and Add new Rule.
Name : Grant Access to Book on Order Completion (You can use any name).
Tags : Not Required.
React on Event : Completing the After updating an existing commerce order
Click on "Save".
15) Click on "+ Add Condition" and select "Data comparison", Data to compare: commerce-order:state , Data value: Completed and click on "Save".
In the Actions,click on "+ Add Loop" and you should be getting "commerce-order:commerce-line-items",just after that in "Variable label *" type "Line Item" & in "Variable name *" type "line_item".
Click on "Save".
16) Repeat Steps 9 and 10 here.
but change the Name of component when you create.
17) Actions:
Click on "+ Add Action" and select "Grant access by user", Content: line-item:commerce-product:field-premium-node:book , GRANT VIEW ACCESS : line-item:order:owner, and remove everything from GRANT UPDATE ACCESS & GRANT DELETE ACCESS
and click on "Save".
18) Perform the Step 13 again for this rule.
Fig: Rule2.
Fig: Component For Rule2.
Done with the configuration of everything.
Create a book, Product Display content and a product content.
--Product display will refer to the Product(Store Product)
--Product(Store Product) will refer to the book.
Hope this will be helpful.
Hello World