From 0f44c50479c46a4f941c042a9dd76fcc6aa08ba4 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 12 Aug 2014 15:27:11 -0500
Subject: [PATCH] Add draft support for site page translataions

---
 include/staff/page.inc.php | 6 ++++--
 scp/pages.php              | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/staff/page.inc.php b/include/staff/page.inc.php
index 714f8ce72..a83de55b3 100644
--- a/include/staff/page.inc.php
+++ b/include/staff/page.inc.php
@@ -150,8 +150,10 @@ $($('option:selected', this).val()).show(); ">
     foreach ($langs as $tag) { ?>
         <div id="translation-<?php echo $tag; ?>" style="display:none" lang="<?php echo $tag; ?>">
         <textarea name="trans[<?php echo $tag; ?>]" cols="21" rows="12"
-            style="width:98%;" class="richtext"
-            ><?php echo $info['trans'][$tag]; ?></textarea>
+            style="width:98%;" class="richtext draft"
+<?php
+    list($draft, $attrs) = Draft::getDraftAndDataAttrs('page', $info['id'].'.'.$tag, $info['trans'][$tag]);
+    echo $attrs; ?>><?php echo $draft ?: $info['trans'][$tag]; ?></textarea>
         </div>
 <?php }
 } ?>
diff --git a/scp/pages.php b/scp/pages.php
index c761d92e2..f818272af 100644
--- a/scp/pages.php
+++ b/scp/pages.php
@@ -48,7 +48,7 @@ if($_POST) {
                 $page->attachments->upload(
                     Draft::getAttachmentIds($_POST['body']),
                     true);
-                Draft::deleteForNamespace('page.'.$page->getId());
+                Draft::deleteForNamespace('page.'.$page->getId().'%');
             } elseif(!$errors['err'])
                 $errors['err'] = sprintf(__('Unable to update %s. Correct error(s) below and try again.'),
                     __('this site page'));
-- 
GitLab