text
stringlengths
0
234
Model.Save_Wiki_Content (Page, Content);
end Create_Wiki_Page;
-- ------------------------------
-- Save the wiki page.
-- ------------------------------
procedure Save (Model : in Wiki_Module;
Page : in out AWA.Wikis.Models.Wiki_Page_Ref'Class) is
pragma Unreferenced (Model);
Ctx : constant Services.Contexts.Service_Context_Access := AWA.Services.Contexts.Current;
DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx);
begin
-- Check that the user has the update wiki page permission on the given wiki space.
AWA.Permissions.Check (Permission => ACL_Update_Wiki_Pages.Permission,
Entity => Page);
Ctx.Start;
Page.Save (DB);
Ctx.Commit;
end Save;
-- ------------------------------
-- Delete the wiki page as well as all its versions.
-- ------------------------------
procedure Delete (Model : in Wiki_Module;
Page : in out AWA.Wikis.Models.Wiki_Page_Ref'Class) is
Ctx : constant Services.Contexts.Service_Context_Access := AWA.Services.Contexts.Current;
DB : ADO.Sessions.Master_Session := AWA.Services.Contexts.Get_Master_Session (Ctx);
begin
-- Check that the user has the delete wiki page permission on the given wiki page.
AWA.Permissions.Check (Permission => ACL_Delete_Wiki_Pages.Permission,
Entity => Page);
Ctx.Start;
-- Before deleting the wiki page, delete the version content.
declare
Stmt : ADO.Statements.Delete_Statement
:= DB.Create_Statement (AWA.Wikis.Models.WIKI_CONTENT_TABLE);
begin
Stmt.Set_Filter (Filter => "page_id = ?");
Stmt.Add_Param (Value => Page);
Stmt.Execute;
Function Definition: procedure Set_Field_Enum is
Function Body: new ADO.Objects.Set_Field_Operation (Format_Type);
Impl : Wiki_Space_Access;
begin
Set_Field (Object, Impl);
Set_Field_Enum (Impl.all, 8, Impl.Format, Value);
end Set_Format;
function Get_Format (Object : in Wiki_Space_Ref)
return AWA.Wikis.Models.Format_Type is
Impl : constant Wiki_Space_Access
:= Wiki_Space_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Format;
end Get_Format;
procedure Set_Workspace (Object : in out Wiki_Space_Ref;
Value : in AWA.Workspaces.Models.Workspace_Ref'Class) is
Impl : Wiki_Space_Access;
begin
Set_Field (Object, Impl);
ADO.Objects.Set_Field_Object (Impl.all, 9, Impl.Workspace, Value);
end Set_Workspace;
function Get_Workspace (Object : in Wiki_Space_Ref)
return AWA.Workspaces.Models.Workspace_Ref'Class is
Impl : constant Wiki_Space_Access
:= Wiki_Space_Impl (Object.Get_Load_Object.all)'Access;
begin
return Impl.Workspace;
end Get_Workspace;
-- Copy of the object.
procedure Copy (Object : in Wiki_Space_Ref;
Into : in out Wiki_Space_Ref) is
Result : Wiki_Space_Ref;
begin
if not Object.Is_Null then
declare
Impl : constant Wiki_Space_Access
:= Wiki_Space_Impl (Object.Get_Load_Object.all)'Access;
Copy : constant Wiki_Space_Access
:= new Wiki_Space_Impl;
begin
ADO.Objects.Set_Object (Result, Copy.all'Access);
Copy.Copy (Impl.all);
Copy.Name := Impl.Name;
Copy.Is_Public := Impl.Is_Public;
Copy.Version := Impl.Version;
Copy.Create_Date := Impl.Create_Date;
Copy.Left_Side := Impl.Left_Side;
Copy.Right_Side := Impl.Right_Side;
Copy.Format := Impl.Format;
Copy.Workspace := Impl.Workspace;