Index: www/controllers/textblock.php
===================================================================
--- www/controllers/textblock.php	(revision 1145)
+++ www/controllers/textblock.php	(working copy)
@@ -4,8 +4,8 @@
 require_once(IA_ROOT_DIR . "common/db/textblock.php");
 require_once(IA_ROOT_DIR . "common/textblock.php");
 require_once(IA_ROOT_DIR . "common/diff.php");
+require_once(IA_ROOT_DIR . "common/tags.php");
 
-
 // View a plain textblock.
 // That textblock can be owned by something else.
 function controller_textblock_view($page_name, $rev_num = null,
@@ -52,6 +52,58 @@
     execute_view_die($display_view, $view);
 }
 
+// View the source of the textblock even if you can't edit it
+function controller_textblock_view_source($page_name, $rev_num = null) {
+
+    $crpage = textblock_get_revision($page_name);
+
+    if ($crpage) {
+        // FIXME: hack to properly display latest revision.
+        // Checks if $rev_num is the latest.
+        $big_title = "Vezi sursa paginii " . $page_name;
+        $rev_count = textblock_get_revision_count($page_name);
+        $current_revision = $rev_num ? $rev_num : $rev_count;
+
+        if ($rev_num && $rev_num != $rev_count) {
+            identity_require("textblock-history", $crpage);
+            $page = textblock_get_revision($page_name, $rev_num);
+            if (!$page) {
+                flash_error("Revizia \"{$rev_num}\" nu exista.");
+                redirect(url_textblock($page_name));
+            }
+        } else {
+            identity_require("textblock-view", $crpage);
+            $page = $crpage;
+        }
+    } else {
+        // Missing page.
+        flash_error("Nu exista pagina, dar poti sa o creezi ...");
+        redirect(url_textblock_edit($page_name));
+    }
+
+    log_assert_valid(textblock_validate($page));
+
+    // Get form data
+    $values = array();
+    $values['text'] = request('text', $page['text']);
+    $values['title'] = request('title', $page['title']);
+
+    $values['forum_topic'] = request('forum_topic', $page['forum_topic']);
+    $values['creation_timestamp'] = getattr($page, 'creation_timestamp');
+    $values['timestamp'] = null;
+
+    // Create view.
+    $view = array();
+    $view['title'] = $big_title;
+    $view['page'] = $page;
+    $view['page_name'] = $page_name;
+    $view['last_revision'] = $current_revision;
+    $view['form_values'] = $values;
+    $view['form_errors'] = array();
+
+    execute_view_die("views/textblock_view_source.php", $view);
+}
+
 // Show differences between two textblock revisions.
 function controller_textblock_diff($page_name) {
     global $identity_user;
Index: www/index.php
===================================================================
--- www/index.php	(revision 1145)
+++ www/index.php	(working copy)
@@ -245,6 +245,11 @@
     require_once(IA_ROOT_DIR.'www/controllers/textblock.php');
     controller_textblock_diff($page);
 }
+//  - view source of the textblock
+else if ($action == 'view-source') {
+    require_once(IA_ROOT_DIR.'www/controllers/textblock.php');
+    controller_textblock_view_source($page, request('revision'));
+}
 
 // attachment controllers
 //  - create attachment
Index: www/url.php
===================================================================
--- www/url.php	(revision 1145)
+++ www/url.php	(working copy)
@@ -88,6 +88,10 @@
     return url_complex($page_name, array('action' => 'history'));
 }
 
+function url_textblock_view_source($page_name) {
+    return url_complex($page_name, array('action' => 'view-source'));
+}
+
 function url_blog_feed() {
     return url_complex('blog', array('action' => 'rss'));
 }
Index: www/views/textblock_header.php
===================================================================
--- www/views/textblock_header.php	(revision 1145)
+++ www/views/textblock_header.php	(working copy)
@@ -9,6 +9,8 @@
 <div id="wikiOps">
     <ul>
 
+<li><?= format_link_access(url_textblock_view_source($textblock['name']), 'Vezi sursa paginii', 'v') ?> </li>
+
 <?php if (($task_id = textblock_security_is_task($textblock['security'])) &&
           identity_can('task-edit', $task = task_get($task_id))) { ?>
 <li><?= format_link_access(url_task_edit($task['id']), 'Editează', 'e') ?></li>
