Index: openacs-4/contrib/packages/bcms/tcl/bcms-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/bcms/tcl/bcms-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/bcms/tcl/bcms-procs.tcl 14 May 2003 15:34:59 -0000 1.1 +++ openacs-4/contrib/packages/bcms/tcl/bcms-procs.tcl 4 Aug 2003 11:19:46 -0000 1.2 @@ -132,3 +132,44 @@ return 0 } } + + +ad_proc -public bcms::create_page { + {-page_name:required} + {-folder_id:required} + {-mime_type "text/plain"} + {-title:required} + {-description ""} + {-page_body ""} + {-creation_user_id} + {-creation_user_ip} +} { + creates a new page and its first revision + + @param page_name name of the page which will be used for the url + @param folder_id the folder_id which the page will be under + @param mime_type mime_type of the page + @param title title of the page + @param description description of the page + @param page_body the contents of a page + @param creation_user_id user_id creating this page + @param creation_user_ip ip address which this page is created + + @returns the page_id of the newly created page +} { + if {![info exists creation_user_id]} { set creation_user_id [ad_conn user_id] } + if {![info exists creation_ip]} { set creation_ip [ad_conn peeraddr] } + + db_transaction { + set page_id [bcms::item::create_item -item_name $page_name -parent_id $folder_id -content_type content_revision \ + -storage_type text -creation_user_id $creation_user_id -creation_ip $creation_ip] + + set revision_id [bcms::revision::add_revision -item_id $page_id \ + -title $title -content $page_body -description $description \ + -mime_type $mime_type \ + -creation_user_id $creation_user_id -creation_ip $creation_ip] + } + + return $page_id + +}