Example #1
0
def serialize_node_for_page(content: Content, context: Context):

    if content.type in (ContentType.Page, ContentType.File) :
        data_container = content

        # The following properties are overriden by revision values
        if content.revision_to_serialize>0:
            for revision in content.revisions:
                if revision.revision_id==content.revision_to_serialize:
                    data_container = revision
                    break

        result = DictLikeClass(
            id=content.content_id,
            parent=context.toDict(content.parent),
            workspace=context.toDict(content.workspace),
            type=content.type,
            is_new=content.has_new_information_for(context.get_user()),
            content=data_container.description,
            created=data_container.created,
            updated=content.last_revision.updated,
            label=data_container.label,
            icon=ContentType.get_icon(content.type),
            owner=context.toDict(content.first_revision.owner),
            last_modification_author=context.toDict(content.last_revision.owner),
            status=context.toDict(data_container.get_status()),
            links=[],
            revision_nb = len(content.revisions),
            selected_revision='latest' if content.revision_to_serialize<=0 else content.revision_to_serialize,
            history=Context(CTX.CONTENT_HISTORY).toDict(content.get_history()),
            is_editable=content.is_editable,
            is_deleted=content.is_deleted,
            is_archived=content.is_archived,
            urls = context.toDict({
                'mark_read': context.url(Content.format_path('/workspaces/{wid}/folders/{fid}/{ctype}s/{cid}/put_read', content)),
                'mark_unread': context.url(Content.format_path('/workspaces/{wid}/folders/{fid}/{ctype}s/{cid}/put_unread', content))
            })
        )

        if content.type == ContentType.File:
            depot = DepotManager.get()
            depot_stored_file = depot.get(data_container.depot_file)
            result.label = content.label
            result['file'] = DictLikeClass(
                name=data_container.file_name,
                size=depot_stored_file.content_length,
                mimetype=data_container.file_mimetype)
        return result

    if content.type==ContentType.Folder:
        value = DictLikeClass(
            id=content.content_id,
            label=content.label,
            is_new=content.has_new_information_for(context.get_user()),
        )
        return value

    raise NotImplementedError
Example #2
0
def serialize_node_for_page(content: Content, context: Context):

    if content.type in (ContentType.Page, ContentType.File) :
        data_container = content

        # The following properties are overriden by revision values
        if content.revision_to_serialize>0:
            for revision in content.revisions:
                if revision.revision_id==content.revision_to_serialize:
                    data_container = revision
                    break

        result = DictLikeClass(
            id=content.content_id,
            parent=context.toDict(content.parent),
            workspace=context.toDict(content.workspace),
            type=content.type,
            is_new=content.has_new_information_for(context.get_user()),
            content=data_container.description,
            created=data_container.created,
            updated=content.last_revision.updated,
            label=data_container.label,
            icon=ContentType.get_icon(content.type),
            owner=context.toDict(content.first_revision.owner),
            last_modification_author=context.toDict(content.last_revision.owner),
            status=context.toDict(data_container.get_status()),
            links=[],
            revision_nb = len(content.revisions),
            selected_revision='latest' if content.revision_to_serialize<=0 else content.revision_to_serialize,
            history=Context(CTX.CONTENT_HISTORY).toDict(content.get_history()),
            is_editable=content.is_editable,
            is_deleted=content.is_deleted,
            is_archived=content.is_archived,
            urls = context.toDict({
                'mark_read': context.url(Content.format_path('/workspaces/{wid}/folders/{fid}/{ctype}s/{cid}/put_read', content)),
                'mark_unread': context.url(Content.format_path('/workspaces/{wid}/folders/{fid}/{ctype}s/{cid}/put_unread', content))
            })
        )

        if content.type == ContentType.File:
            depot = DepotManager.get()
            depot_stored_file = depot.get(data_container.depot_file)
            result.label = content.label
            result['file'] = DictLikeClass(
                name=data_container.file_name,
                size=depot_stored_file.content_length,
                mimetype=data_container.file_mimetype)
        return result

    if content.type==ContentType.Folder:
        value = DictLikeClass(
            id=content.content_id,
            label=content.label,
            is_new=content.has_new_information_for(context.get_user()),
        )
        return value

    raise NotImplementedError
Example #3
0
def serialize_node_for_page(item: Content, context: Context):
    if item.type == ContentType.Thread:
        return DictLikeClass(
            content=item.description,
            created=item.created,
            icon=ContentType.get_icon(item.type),
            id=item.content_id,
            label=item.label,
            links=[],
            owner=context.toDict(item.owner),
            parent=context.toDict(item.parent),
            selected_revision='latest',
            status=context.toDict(item.get_status()),
            type=item.type,
            workspace=context.toDict(item.workspace),
            comments=reversed(context.toDict(item.get_comments())),
            is_new=item.has_new_information_for(context.get_user()),
            history=Context(CTX.CONTENT_HISTORY).toDict(item.get_history()),
            urls=context.toDict({
                'mark_read':
                context.url(
                    Content.format_path(
                        '/workspaces/{wid}/folders/{fid}/{ctype}s/{cid}/put_read',
                        item)),
                'mark_unread':
                context.url(
                    Content.format_path(
                        '/workspaces/{wid}/folders/{fid}/{ctype}s/{cid}/put_unread',
                        item))
            }),
        )

    if item.type == ContentType.Comment:
        return DictLikeClass(
            is_new=item.has_new_information_for(context.get_user()),
            content=item.description,
            created=item.created,
            created_as_delta=item.created_as_delta(),
            icon=ContentType.get_icon(item.type),
            id=item.content_id,
            label=item.label,
            owner=context.toDict(item.owner),
            # REMOVE parent = context.toDict(item.parent),
            type=item.type,
            urls=context.toDict({
                'delete':
                context.url(
                    '/workspaces/{wid}/folders/{fid}/{ctype}/{cid}/comments/{commentid}/put_delete'
                    .format(wid=item.workspace_id,
                            fid=item.parent.parent_id,
                            ctype=item.parent.type + 's',
                            cid=item.parent.content_id,
                            commentid=item.content_id))
            }))

    if item.type == ContentType.Folder:
        return Context(CTX.DEFAULT).toDict(item)
Example #4
0
def serialize_node_for_page(content: Content, context: Context):

    if content.type in (ContentType.Page, ContentType.File) :
        data_container = content

        # The following properties are overriden by revision values
        if content.revision_to_serialize>0:
            for revision in content.revisions:
                if revision.revision_id==content.revision_to_serialize:
                    data_container = revision
                    break

        result = DictLikeClass(
            id=content.content_id,
            parent=context.toDict(content.parent),
            workspace=context.toDict(content.workspace),
            type=content.type,
            is_new=content.has_new_information_for(context.get_user()),
            content=data_container.description,
            created=data_container.created,
            label=data_container.label,
            icon=ContentType.get_icon(content.type),
            owner=context.toDict(data_container.owner),
            status=context.toDict(data_container.get_status()),
            links=context.toDict(content.extract_links_from_content(data_container.description)),
            revisions=context.toDict(sorted(content.revisions, key=lambda v: v.created, reverse=True)),
            selected_revision='latest' if content.revision_to_serialize<=0 else content.revision_to_serialize,
            history=Context(CTX.CONTENT_HISTORY).toDict(content.get_history()),
            urls = context.toDict({
                'mark_read': context.url(Content.format_path('/workspaces/{wid}/folders/{fid}/{ctype}s/{cid}/put_read', content)),
                'mark_unread': context.url(Content.format_path('/workspaces/{wid}/folders/{fid}/{ctype}s/{cid}/put_unread', content))
            })
        )

        if content.type==ContentType.File:
            result.label = content.label if content.label else content.file_name
            result['file'] = DictLikeClass(
                name = data_container.file_name,
                size = len(data_container.file_content),
                mimetype = data_container.file_mimetype)
        return result

    if content.type==ContentType.Folder:
        value = DictLikeClass(
            id=content.content_id,
            label=content.label,
            is_new=content.has_new_information_for(context.get_user()),
        )
        return value

    raise NotImplementedError
Example #5
0
def serialize_node_for_thread(item: Content, context: Context):
    if item.type in (ContentType.Thread, ContentType.Task, ContentType.Ticket):
        return DictLikeClass(
            content = item.description,
            created = item.created,
            updated = item.last_revision.updated,
            revision_nb = len(item.revisions),
            icon = ContentType.get_icon(item.type),
            id = item.content_id,
            label = item.label,
            links=[],
            owner = context.toDict(item.owner),
            last_modification_author=context.toDict(item.last_revision.owner),
            parent = context.toDict(item.parent),
            selected_revision = 'latest',
            status = context.toDict(item.get_status()),
            type = item.type,
            workspace = context.toDict(item.workspace),
            comments = reversed(context.toDict(item.get_comments())),
            is_new=item.has_new_information_for(context.get_user()),
            history = Context(CTX.CONTENT_HISTORY).toDict(item.get_history()),
            is_editable=item.is_editable,
            is_deleted=item.is_deleted,
            is_archived=item.is_archived,
            urls = context.toDict({
                'mark_read': context.url(Content.format_path('/workspaces/{wid}/folders/{fid}/{ctype}s/{cid}/put_read', item)),
                'mark_unread': context.url(Content.format_path('/workspaces/{wid}/folders/{fid}/{ctype}s/{cid}/put_unread', item))
            }),
        )

    if item.type == ContentType.Comment:
        return DictLikeClass(
            is_new=item.has_new_information_for(context.get_user()),
            content = item.description,
            created = item.created,
            created_as_delta = item.created_as_delta(),
            icon = ContentType.get_icon(item.type),
            id = item.content_id,
            label = item.label,
            owner = context.toDict(item.owner),
            # REMOVE parent = context.toDict(item.parent),
            type = item.type,
            urls = context.toDict({
                'delete': context.url('/workspaces/{wid}/folders/{fid}/{ctype}/{cid}/comments/{commentid}/put_delete'.format(wid = item.workspace_id, fid=item.parent.parent_id, ctype=item.parent.type+'s', cid=item.parent.content_id, commentid=item.content_id))
            })
        )

    if item.type==ContentType.Folder:
        return Context(CTX.DEFAULT).toDict(item)
Example #6
0
def designThread(content: data.Content, content_revision: data.ContentRevisionRO, comments) -> str:
        hist = content.get_history()

        allT = []
        allT += comments
        allT += hist
        allT.sort(key=lambda x: x.created, reverse=True)

        disc = ''
        participants = {}
        for t in allT:
            if t.type == ContentType.Comment:
                disc += '''
                    <div class="row comment comment-row">
                        <i class="fa fa-comment-o comment-icon"></i>
                            <div class="comment-content">
                            <h5>
                                <span class="comment-author"><b>%s</b> wrote :</span>
                                <div class="pull-right text-right">%s</div>
                            </h5>
                            %s
                        </div>
                    </div>
                    ''' % (t.owner.display_name, create_readable_date(t.created), t.description)

                if t.owner.display_name not in participants:
                    participants[t.owner.display_name] = [1, t.created]
                else:
                    participants[t.owner.display_name][0] += 1
            else:
                if isinstance(t, VirtualEvent) and t.type.id != 'comment':
                    label = _LABELS[t.type.id]

                    disc += '''
                    <div class="%s row comment comment-row to-hide">
                        <i class="fa %s comment-icon"></i>
                            <div class="comment-content">
                            <h5>
                                <span class="comment-author"><b>%s</b></span>
                                <div class="pull-right text-right">%s</div>
                            </h5>
                            %s %s
                        </div>
                    </div>
                    ''' % ('warning' if t.id == content_revision.revision_id else '',
                           t.type.icon,
                           t.owner.display_name,
                           t.create_readable_date(),
                           label,
                            # NOTE: (WABDAV_HIST_DEL_DISABLED) Disabled for beta 1.0
                            '<i class="fa fa-caret-left"></i> shown' if t.id == content_revision.revision_id else '' # else '''<span><a class="revision-link" href="/.history/%s/%s-%s">(View revision)</a></span>''' % (
                               # content.label,
                               # t.id,
                               # t.ref_object.label) if t.type.id in ['revision', 'creation', 'edition'] else '')
                           )

        page = '''
<html>
<head>
	<title>%s</title>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
	<style>%s</style>
	<script type="text/javascript" src="/home/arnaud/Documents/css/script.js"></script>
</head>
<body>
    <div id="left" class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <div class="title thread">
            <div class="title-text">
                <i class="fa fa-comments-o title-icon thread"></i>
                <h1>%s</h1>
                <h6>thread created on <b>%s</b> by <b>%s</b></h6>
            </div>
            <div class="pull-right">
                <div class="btn-group btn-group-vertical">
                    <!-- NOTE: Not omplemented yet, don't display not working link
                    <a class="btn btn-default" onclick="hide_elements()">
                       <i id="hideshow" class="fa fa-eye-slash"></i> <span id="hideshowtxt" >Hide history</span></a>
                    </a>-->
                    <a class="btn btn-default">
                        <i class="fa fa-external-link"></i> View in tracim</a>
                    </a>
                </div>
            </div>
        </div>
        <div class="content col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <div class="description">
                <span class="description-text">%s</span>
            </div>
            %s
        </div>
    </div>
    <script type="text/javascript">
        window.onload = function() {
            file_location = window.location.href
            file_location = file_location.replace(/\/[^/]*$/, '')
            file_location = file_location.replace(/\/.history\/[^/]*$/, '')

            // NOTE: (WABDAV_HIST_DEL_DISABLED) Disabled for beta 1.0
            // $('.revision-link').each(function() {
            //     $(this).attr('href', file_location + $(this).attr('href'))
            // });
        }

        function hide_elements() {
            elems = document.getElementsByClassName('to-hide');
            if (elems.length > 0) {
                for(var i = 0; i < elems.length; i++) {
                    $(elems[i]).addClass('to-show')
                    $(elems[i]).hide();
                }
                while (elems.length>0) {
                    $(elems[0]).removeClass('comment-row');
                    $(elems[0]).removeClass('to-hide');
                }
                $('#hideshow').addClass('fa-eye').removeClass('fa-eye-slash');
                $('#hideshowtxt').html('Show history');
            }
            else {
                elems = document.getElementsByClassName('to-show');
                for(var i = 0; i<elems.length; i++) {
                    $(elems[0]).addClass('comment-row');
                    $(elems[i]).addClass('to-hide');
                    $(elems[i]).show();
                }
                while (elems.length>0) {
                    $(elems[0]).removeClass('to-show');
                }
                $('#hideshow').removeClass('fa-eye').addClass('fa-eye-slash');
                $('#hideshowtxt').html('Hide history');
            }
        }
    </script>
</body>
</html>
        ''' % (content_revision.label,
               style,
               content_revision.label,
               content.created.strftime("%B %d, %Y at %H:%m"),
               content.owner.display_name,
               content_revision.description,
               disc)

        return page
Example #7
0
def designPage(content: data.Content, content_revision: data.ContentRevisionRO) -> str:
    hist = content.get_history()
    histHTML = '<table class="table table-striped table-hover">'
    for event in hist:
        if isinstance(event, VirtualEvent):
            date = event.create_readable_date()
            label = _LABELS[event.type.id]

            histHTML += '''
                <tr class="%s">
                    <td class="my-align"><span class="label label-default"><i class="fa %s"></i> %s</span></td>
                    <td>%s</td>
                    <td>%s</td>
                    <td>%s</td>
                </tr>
                ''' % ('warning' if event.id == content_revision.revision_id else '',
                       event.type.icon,
                       label,
                       date,
                       event.owner.display_name,
                       # NOTE: (WABDAV_HIST_DEL_DISABLED) Disabled for beta 1.0
                       '<i class="fa fa-caret-left"></i> shown'  if event.id == content_revision.revision_id else '' # '''<span><a class="revision-link" href="/.history/%s/(%s - %s) %s.html">(View revision)</a></span>''' % (
                       # content.label, event.id, event.type.id, event.ref_object.label) if event.type.id in ['revision', 'creation', 'edition'] else '')
                   )
    histHTML += '</table>'

    file = '''
<html>
<head>
	<title>%s</title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
	<style>%s</style>
	<script type="text/javascript" src="/home/arnaud/Documents/css/script.js"></script>
	<script
			  src="https://code.jquery.com/jquery-3.1.0.min.js"
			  integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s="
			  crossorigin="anonymous"></script>
</head>
<body>
    <div id="left" class="col-lg-8 col-md-12 col-sm-12 col-xs-12">
        <div class="title page">
            <div class="title-text">
                <i class="fa fa-file-text-o title-icon page"></i>
                <h1>%s</h1>
                <h6>page created on <b>%s</b> by <b>%s</b></h6>
            </div>
            <div class="pull-right">
                <div class="btn-group btn-group-vertical">
                    <!-- NOTE: Not omplemented yet, don't display not working link
                     <a class="btn btn-default">
                         <i class="fa fa-external-link"></i> View in tracim</a>
                     </a>-->
                </div>
            </div>
        </div>
        <div class="content col-xs-12 col-sm-12 col-md-12 col-lg-12">
            %s
        </div>
    </div>
    <div id="right" class="col-lg-4 col-md-12 col-sm-12 col-xs-12">
        <h4>History</h4>
        %s
    </div>
    <script type="text/javascript">
        window.onload = function() {
            file_location = window.location.href
            file_location = file_location.replace(/\/[^/]*$/, '')
            file_location = file_location.replace(/\/.history\/[^/]*$/, '')

            // NOTE: (WABDAV_HIST_DEL_DISABLED) Disabled for beta 1.0
            // $('.revision-link').each(function() {
            //    $(this).attr('href', file_location + $(this).attr('href'))
            // });
        }
    </script>
</body>
</html>
        ''' % (content_revision.label,
               style,
               content_revision.label,
               content.created.strftime("%B %d, %Y at %H:%m"),
               content.owner.display_name,
               content_revision.description,
               histHTML)

    return file
Example #8
0
def designPage(content: data.Content,
               content_revision: data.ContentRevisionRO) -> str:
    f = open('tracim/lib/webdav/style.css', 'r')
    style = f.read()
    f.close()

    hist = content.get_history()
    histHTML = '<table class="table table-striped table-hover">'
    for event in hist:
        if isinstance(event, VirtualEvent):
            date = event.create_readable_date()
            _LABELS = {
                'archiving': 'Item archived',
                'content-comment': 'Item commented',
                'creation': 'Item created',
                'deletion': 'Item deleted',
                'edition': 'item modified',
                'revision': 'New revision',
                'status-update': 'New status',
                'unarchiving': 'Item unarchived',
                'undeletion': 'Item undeleted',
                'move': 'Item moved'
            }

            label = _LABELS[event.type.id]

            histHTML += '''
                <tr class="%s">
                    <td class="my-align"><span class="label label-default"><i class="fa %s"></i> %s</span></td>
                    <td>%s</td>
                    <td>%s</td>
                    <td>%s</td>
                </tr>
                ''' % (
                'warning' if event.id == content_revision.revision_id else '',
                event.type.icon,
                label,
                date,
                event.owner.display_name,
                # NOTE: (WABDAV_HIST_DEL_DISABLED) Disabled for beta 1.0
                '<i class="fa fa-caret-left"></i> shown'
                if event.id == content_revision.revision_id else
                ''  # '''<span><a class="revision-link" href="/.history/%s/(%s - %s) %s.html">(View revision)</a></span>''' % (
                # content.label, event.id, event.type.id, event.ref_object.label) if event.type.id in ['revision', 'creation', 'edition'] else '')
            )
    histHTML += '</table>'

    file = '''
<html>
<head>
	<title>%s</title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
	<style>%s</style>
	<script type="text/javascript" src="/home/arnaud/Documents/css/script.js"></script>
	<script
			  src="https://code.jquery.com/jquery-3.1.0.min.js"
			  integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s="
			  crossorigin="anonymous"></script>
</head>
<body>
    <div id="left" class="col-lg-8 col-md-12 col-sm-12 col-xs-12">
        <div class="title page">
            <div class="title-text">
                <i class="fa fa-file-text-o title-icon page"></i>
                <h1>%s</h1>
                <h6>page created on <b>%s</b> by <b>%s</b></h6>
            </div>
            <div class="pull-right">
                <div class="btn-group btn-group-vertical">
                    <!-- NOTE: Not omplemented yet, don't display not working link
                     <a class="btn btn-default">
                         <i class="fa fa-external-link"></i> View in tracim</a>
                     </a>-->
                </div>
            </div>
        </div>
        <div class="content col-xs-12 col-sm-12 col-md-12 col-lg-12">
            %s
        </div>
    </div>
    <div id="right" class="col-lg-4 col-md-12 col-sm-12 col-xs-12">
        <h4>History</h4>
        %s
    </div>
    <script type="text/javascript">
        window.onload = function() {
            file_location = window.location.href
            file_location = file_location.replace(/\/[^/]*$/, '')
            file_location = file_location.replace(/\/.history\/[^/]*$/, '')

            // NOTE: (WABDAV_HIST_DEL_DISABLED) Disabled for beta 1.0
            // $('.revision-link').each(function() {
            //    $(this).attr('href', file_location + $(this).attr('href'))
            // });
        }
    </script>
</body>
</html>
        ''' % (content_revision.label, style, content_revision.label,
               content.created.strftime("%B %d, %Y at %H:%m"),
               content.owner.display_name, content_revision.description,
               histHTML)

    return file
Example #9
0
def designThread(content: data.Content,
                 content_revision: data.ContentRevisionRO, comments) -> str:
    f = open('tracim/lib/webdav/style.css', 'r')
    style = f.read()
    f.close()

    hist = content.get_history()

    allT = []
    allT += comments
    allT += hist
    allT.sort(key=lambda x: x.created, reverse=True)

    disc = ''
    participants = {}
    for t in allT:
        if t.type == ContentType.Comment:
            disc += '''
                    <div class="row comment comment-row">
                        <i class="fa fa-comment-o comment-icon"></i>
                            <div class="comment-content">
                            <h5>
                                <span class="comment-author"><b>%s</b> wrote :</span>
                                <div class="pull-right text-right">%s</div>
                            </h5>
                            %s
                        </div>
                    </div>
                    ''' % (t.owner.display_name, create_readable_date(
                t.created), t.description)

            if t.owner.display_name not in participants:
                participants[t.owner.display_name] = [1, t.created]
            else:
                participants[t.owner.display_name][0] += 1
        else:
            if isinstance(t, VirtualEvent) and t.type.id != 'comment':
                _LABELS = {
                    'archiving': 'Item archived',
                    'content-comment': 'Item commented',
                    'creation': 'Item created',
                    'deletion': 'Item deleted',
                    'edition': 'item modified',
                    'revision': 'New revision',
                    'status-update': 'New status',
                    'unarchiving': 'Item unarchived',
                    'undeletion': 'Item undeleted',
                    'move': 'Item moved',
                    'comment': 'hmmm'
                }

                label = _LABELS[t.type.id]

                disc += '''
                    <div class="%s row comment comment-row to-hide">
                        <i class="fa %s comment-icon"></i>
                            <div class="comment-content">
                            <h5>
                                <span class="comment-author"><b>%s</b></span>
                                <div class="pull-right text-right">%s</div>
                            </h5>
                            %s %s
                        </div>
                    </div>
                    ''' % (
                    'warning' if t.id == content_revision.revision_id else '',
                    t.type.icon,
                    t.owner.display_name,
                    t.create_readable_date(),
                    label,
                    # NOTE: (WABDAV_HIST_DEL_DISABLED) Disabled for beta 1.0
                    '<i class="fa fa-caret-left"></i> shown'
                    if t.id == content_revision.revision_id else
                    ''  # else '''<span><a class="revision-link" href="/.history/%s/%s-%s">(View revision)</a></span>''' % (
                    # content.label,
                    # t.id,
                    # t.ref_object.label) if t.type.id in ['revision', 'creation', 'edition'] else '')
                )

    page = '''
<html>
<head>
	<title>%s</title>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
	<style>%s</style>
	<script type="text/javascript" src="/home/arnaud/Documents/css/script.js"></script>
</head>
<body>
    <div id="left" class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <div class="title thread">
            <div class="title-text">
                <i class="fa fa-comments-o title-icon thread"></i>
                <h1>%s</h1>
                <h6>thread created on <b>%s</b> by <b>%s</b></h6>
            </div>
            <div class="pull-right">
                <div class="btn-group btn-group-vertical">
                    <!-- NOTE: Not omplemented yet, don't display not working link
                    <a class="btn btn-default" onclick="hide_elements()">
                       <i id="hideshow" class="fa fa-eye-slash"></i> <span id="hideshowtxt" >Hide history</span></a>
                    </a>-->
                    <a class="btn btn-default">
                        <i class="fa fa-external-link"></i> View in tracim</a>
                    </a>
                </div>
            </div>
        </div>
        <div class="content col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <div class="description">
                <span class="description-text">%s</span>
            </div>
            %s
        </div>
    </div>
    <script type="text/javascript">
        window.onload = function() {
            file_location = window.location.href
            file_location = file_location.replace(/\/[^/]*$/, '')
            file_location = file_location.replace(/\/.history\/[^/]*$/, '')

            // NOTE: (WABDAV_HIST_DEL_DISABLED) Disabled for beta 1.0
            // $('.revision-link').each(function() {
            //     $(this).attr('href', file_location + $(this).attr('href'))
            // });
        }

        function hide_elements() {
            elems = document.getElementsByClassName('to-hide');
            if (elems.length > 0) {
                for(var i = 0; i < elems.length; i++) {
                    $(elems[i]).addClass('to-show')
                    $(elems[i]).hide();
                }
                while (elems.length>0) {
                    $(elems[0]).removeClass('comment-row');
                    $(elems[0]).removeClass('to-hide');
                }
                $('#hideshow').addClass('fa-eye').removeClass('fa-eye-slash');
                $('#hideshowtxt').html('Show history');
            }
            else {
                elems = document.getElementsByClassName('to-show');
                for(var i = 0; i<elems.length; i++) {
                    $(elems[0]).addClass('comment-row');
                    $(elems[i]).addClass('to-hide');
                    $(elems[i]).show();
                }
                while (elems.length>0) {
                    $(elems[0]).removeClass('to-show');
                }
                $('#hideshow').removeClass('fa-eye').addClass('fa-eye-slash');
                $('#hideshowtxt').html('Hide history');
            }
        }
    </script>
</body>
</html>
        ''' % (content_revision.label, style, content_revision.label,
               content.created.strftime("%B %d, %Y at %H:%m"),
               content.owner.display_name, content_revision.description, disc)

    return page