]> git.mxchange.org Git - friendica.git/commitdiff
photo editing
authorMike Macgirvin <mike@macgirvin.com>
Sun, 8 Aug 2010 08:58:26 +0000 (01:58 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Sun, 8 Aug 2010 08:58:26 +0000 (01:58 -0700)
htconfig.php
index.php
mod/contacts.php
mod/photos.php
view/photo_edit.tpl
view/style.css

index aab00a972f3e5d6e63237d8f044f1e53f7324533..e9c2db3507f6cc5b5bcd03646a12f2e5c076e1aa 100644 (file)
@@ -28,6 +28,6 @@ $a->config['register_policy'] = REGISTER_OPEN;
 $a->config['register_text'] = '';
 $a->config['admin_email'] = '';
 
-// Maximum size of an imported message, 0 is unlimited.
+// Maximum size of an imported message, 0 is unlimited (but our database 'text' element is limited to 65535).
 
 $a->config['max_import_size'] = 10000;
\ No newline at end of file
index a30c69d37d21f6d0796950993bad9796dbdbe4d5..e27d6f04fa5efb51ed2b49ca087f48b777b6d493 100644 (file)
--- a/index.php
+++ b/index.php
@@ -43,8 +43,8 @@ if(strlen($a->module)) {
 // invoke module functions
 // Important: Modules normally do not emit content, unless you need it for debugging.
 // The module_init, module_post, and module_afterpost functions process URL parameters and POST processing.
-// The module_content function returns content text to this function where it is included on the page.
-// Modules emitting XML/Atom, etc. should do so in the _init function and promptly exit.
+// The module_content function returns content text to this file where it is included on the page.
+// Modules emitting XML/Atom, etc. should do so idirectly and promptly exit before the HTML page can be rendered.
 // "Most" HTML resides in the view directory as text templates with macro substitution. 
 // They look like HTML with PHP variables but only a couple pass through the PHP processor - those with .php extensions.
 // The macro substitution is defined per page for the .tpl files. 
index c1b3781bf6376f88a4992a0f4262b5217176798c..89e1f24df4727f358ebb51f8330e1da5e3c30a2d 100644 (file)
@@ -187,7 +187,7 @@ function contacts_content(&$a) {
                        '$poll_interval' => contact_poll_interval($r[0]['priority']),
                        '$last_update' => (($r[0]['last-update'] == '0000-00-00 00:00:00') 
                                ? t('Never') 
-                               : datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, G:i A')),
+                               : datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, g:i A')),
                        '$profile_select' => contact_profile_assign($r[0]['profile-id']),
                        '$contact_id' => $r[0]['id'],
                        '$block_text' => (($r[0]['blocked']) ? t('Unblock this contact') : t('Block this contact') ),
index e680bc5a2fc3c2c5ead0e188c62d0dbd677dde7d..ca05f651bc72ae28e402bdfe92804051f9edbade 100644 (file)
@@ -51,6 +51,29 @@ function photos_post(&$a) {
                 killme();
         }
 
+       if(($a->argc > 1) && (x($_POST,'desc') !== false)) {
+               $desc = notags(trim($_POST['desc']));
+               $tags = notags(trim($_POST['tags']));
+               $item_id = intval($_POST['item_id']);
+               $id = $a->argv[1];
+
+               $r = q("UPDATE `photo` SET `desc` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
+                       dbesc($desc),
+                       intval($id),
+                       intval($_SESSION['uid'])
+               );
+               $r = q("UPDATE `item` SET `tag` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
+                       dbesc($tags),
+                       intval($item_id),
+                       intval($_SESSION['uid'])
+               );
+
+               goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+               return; // NOTREACHED
+       }
+
+
+
        $r = q("SELECT * FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid` WHERE `user`.`uid` = %d AND `self` = 1 LIMIT 1",
                intval($_SESSION['uid'])
        );
@@ -409,11 +432,17 @@ function photos_content(&$a) {
                
                $o .= '<h3>' . '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($ph[0]['album']) . '">' . $ph[0]['album'] . '</a></h3>';
  
+               if(local_user() && ($ph[0]['uid'] == $_SESSION['uid'])) {
+                       $o .= '<div id="photo-edit-link-wrap" ><a id="photo-edit-link" href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $datum . '/edit' . '">' . t('Edit photo') . '</a></div>';
+               }
+
+
                $o .= '<a href="' . $a->get_baseurl() . '/photo/' 
                        . $hires['resource-id'] . '-' . $hires['scale'] . '.jpg" title="' 
                        . t('View Full Size') . '" ><img src="' . $a->get_baseurl() . '/photo/' 
                        . $lores['resource-id'] . '-' . $lores['scale'] . '.jpg' . '" /></a>';
 
+
                // Do we have an item for this photo?
 
                $i1 = q("SELECT * FROM `item` WHERE `resource-id` = '%s' $sql_extra LIMIT 1",
@@ -465,7 +494,14 @@ function photos_content(&$a) {
                        if($cmd == 'edit') {
                                $edit_tpl = file_get_contents('view/photo_edit.tpl');
                                $o .= replace_macros($edit_tpl, array(
-                                       '$id' => $ph[0]['id']
+                                       '$id' => $ph[0]['id'],
+                                       '$capt_label' => t('Caption'),
+                                       '$caption' => $ph[0]['desc'],
+                                       '$tag_label' => t('Tags'),
+                                       '$tags' => $i1[0]['tag'],
+                                       '$item_id' => $i1[0]['id'],
+                                       '$submit' => t('Submit') 
+
                                ));
                        }
 
index 7b579492f793cc218286dfa23a90974f048314ae..e506375781385d72d4ad3c5364980dd70ea0a393 100644 (file)
@@ -1,11 +1,17 @@
 
-<form action="photos" method="post" id="photo_edit_form" >
+<form action="photos/$id" method="post" id="photo_edit_form" >
+
+       <input type="hidden" name="item_id" value="$item_id" />
 
        <label id="photo-edit-caption-label" for="photo-edit-caption">$capt_label</label>
-       <input type="text size="64" name="desc" value="$caption" />
+       <input id="photo-edit-caption" type="text" size="64" name="desc" value="$caption" />
+
+       <div id="photo-edit-caption-end"></div>
 
        <label id="photo-edit-tags-label" for="photo-edit-tags-textarea" >$tag_label</label>
        <textarea name="tags" id="photo-edit-tags-textarea">$tags</textarea>
+       <div id="photo-edit-tags-end"></div>
 
        <input type="submit" name="submit" value="$submit" />
+       <div id="photo-edit-end"></div>
 </form>
index 6bba5b57777f380335388cef42616084841313b8..c590b531742c56fb7243475c172febb40f4a88e0 100644 (file)
@@ -1339,3 +1339,33 @@ input#dfrn-url {
        text-decoration: underline;
        cursor: pointer;
 }
+
+#photo-edit-caption-label, #photo-edit-tags-label {
+       float: left; 
+       width: 150px;
+}
+#photo-edit-caption, #photo-edit-tags-textarea {
+       float: left;
+}
+
+#photo-edit-caption-end, #photo-edit-tags-end {
+       clear: both;
+}
+
+#photo-caption {
+       font-size: 110%;
+       font-weight: bold;
+       margin-top: 15px;
+       margin-bottom: 15px;
+}
+
+#in-this-photo-text {
+       color: #0000FF;
+       margin-left: 30px;
+}      
+
+#in-this-photo {
+       margin-left: 60px;
+       margin-top: 10px;
+       margin-bottom: 20px;
+}
\ No newline at end of file