+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: wiki.create with preset values using api

  1. #1

    Default wiki.create with preset values using api

    Hi everyone,

    I want to create a new page with a button using wiki.create, and pre-set the tags of this new page with a value derived from a form (date with jquery datepicker). If I understood, I have to use the API. The tutorial "Programming the MindTouch API with PHP" gives some good ideas, but I actually don't know who integrate the php file. Do I have to realise this as an extension?

    Can anybody give me some advices? Many thanks!

  2. #2
    Join Date
    Jul 2009
    Location
    Girona, SPAIN
    Posts
    547

    Default

    This page makes your desires:

    http://developer.mindtouch.com/User:..._page_creation

    No API calls required

  3. #3

    Default

    Quote Originally Posted by carles.coll View Post
    This page makes your desires:

    http://developer.mindtouch.com/User:..._page_creation

    No API calls required
    Thanks Carles, it works perfectly! Nevertheless can anybody tell me how to integrate for example the dreamplug_tutorial.php?

  4. #4
    Join Date
    Feb 2010
    Posts
    59

    Default

    Quote Originally Posted by carles.coll View Post
    This page makes your desires:

    http://developer.mindtouch.com/User:..._page_creation

    No API calls required
    Charles,

    I'd also find this functionality useful - however, when trying to view the content of the page, I can't view source or anything like that to see how it has been constructed (even though I'm logged in).

    Can you please set the permissions so that logged in users can view or alternately direct me to an explanatory page - I have guessed that the templates AddingTagsContainer and AddTagsTemplate are involved, but don't fully understand how it all fits together (and how it's invoked in the first place).

    Also, is the 'edit' command documented anywhere?

    Kind regards,

    Alex.

  5. #5
    Join Date
    Oct 2007
    Location
    San Diego, CA
    Posts
    1,237

    Default

    Quote Originally Posted by muppel View Post
    Thanks Carles, it works perfectly! Nevertheless can anybody tell me how to integrate for example the dreamplug_tutorial.php?
    Check out the PHP tutorials in the kb, http://developer.mindtouch.com/en/kb?v=language

    Here are a few related to plugins:
    http://developer.mindtouch.com/en/kb...orld%22_plugin
    http://developer.mindtouch.com/en/kb...ality_with_PHP

    A general plugin overview as well:
    http://developer.mindtouch.com/en/ref/PHP/Plugins

  6. #6
    Join Date
    Jul 2009
    Location
    Girona, SPAIN
    Posts
    547

    Default

    The code below the page it's (I don't know why you can see it, it's not hidden at all):

    Code:
     // -- The following line just recovers the page tags, and concatenates them on a String separated by commas
    var t = string.join([ t.value foreach var t in page.tags],",");
     // -- The following line make the button to create the new page
     // --- label -> The label for the button
     // --- button -> Show a button
     // --- template -> The template for the new page ( I will explain it later on )
     // --- title -> New page title
     // --- args -> The new page arguments ( on this case the tags string on a parameter called tags )
    wiki.create{label: "Make new page with this page tags", button: true,
       template: "AddingTagsContainer",
       title: "New template with parent tags", args: { tags: t } };
    Template (AddingTagsContainer): http://developer.mindtouch.com/templ...gTagsContainer
    1. This template just recovers the tags from the list pased on the argument tags
    2. Then it generated a page content that when a new page get's saved creates the page tags

    edit: -> When you save a page, the code after the edit: will be executed and the result of the code will be writed on the page, I mean:

    You write:

    {{ edit: Date.Now; }}

    You Save, and you see:

    2010/04/17 10:10 GMT

    You edit again and you don't se the original code you see the result:

    2010/04/17 10:10 GMT

    Carles

  7. #7
    Join Date
    Feb 2010
    Posts
    59

    Default

    Thanks Carles.

    I don't know why but I couldn't get into edit mode on the collaboration portal last week for some reason (despite being logged in) - this seems to work again now.

    I think the edit: command is going to be quite useful!

    Thanks.

    Alex.

  8. #8
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    Minor correction:

    {{ save: user.name }}
    --> execute dekiscript at save time and replace block with result

    {{ edit: user.name }}
    --> execute dekiscript at edit time and replace block with result


    To see the difference, use the tag in a template and then insert into a page using the template dialog. The former will not be replaced until you save the page, while the latter will be replaced as soon as the template is loaded into the editor.
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

  9. #9

    Default May be it my template:tag-insert problem?

    Quote Originally Posted by carles.coll View Post
    This page makes your desires:

    http://developer.mindtouch.com/User:..._page_creation

    No API calls required
    I try several times and i don't understand where is problem. I put all templates on my wiki. And there is a page http://it-skills.ru/User:admin/Add_T..._page_creation It works - tags are passed to a new page but they are inserted not as a tags but as a href="#Tags_Name

    Many thanks for your help

  10. #10
    Join Date
    Jul 2009
    Location
    Girona, SPAIN
    Posts
    547

    Default

    Maybe it's something with Mindtouch Version o something with Cirilic characters.

    Try to create a template with the Page http://it-skills.ru/User:admin/Add_T..._page_creation tags and create a new page inserting this template, this way you can know if the problem comes to on of the two mentioned problems or maybe some sort of error on the code.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts